eclipse.jdt.ls
eclipse.jdt.ls copied to clipboard
Consider token to limit the chains that are searched
This draft use a copy of ChainFinder to tryout using token to limit the number of chain produced by the the chain finder. Instead of increasing the chain size which could potentially go into more deeper search, this approach provides the capability to user to filter by the token to find the most relevant chains the user is searching for.
@rgrunber @jdneo @testforstephen @snjeza what do you think about this change ?
We could increase this, but as mentioned in https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/2730#issuecomment-1620725555, I think we'll be limited by the performance of the chain search. Increasing the maximum chains might not necessarily mean more chains if we're always hitting the timeout, and returning no results. Part of the reason I kept it so small, is I felt there would be a limited number of chains that are useful.
I will have a look at that root cause to see if we can improve the type resolution over there in jdt.
@rgrunber Can you check my new way of tackling the same issue ? if it looks good, I can add the changes to jdt chain finder and use it in JDT LS, while we keep that open for JDT project adapt if there is any contributor for JDT.UI.
This would eliminate
EMPTY_LIST. Are you ok with that for now ?
What if we make the token match case insensitive and let the completion filter handle the rest ? So if I type empty I should get both.
@rgrunber WDYT about latest changes ? If this looks good, would you prefer adding this changes to jdt.ui or should we keep a copy of ChainFinder in jdt.ls and evolve further here ?
Could we use ChainFinder directly from jdt.core.manipulation. I'd be fine with merging directly in there if anything extra is needed.
Depends on https://github.com/eclipse-jdt/eclipse.jdt.ui/pull/1282
@rgrunber the PR is ready now
@rgrunber do you think we can merge this as well to master ?
Yes, I plan to review this. I'm guessing if we merge this, we can also close https://github.com/eclipse-jdtls/eclipse.jdt.ls/pull/2935 (that commit is included here) ? I guess my only complaint there was about using CompletionProposal, but if the reasoning was because it stays closer to existing code (and its coupling with that class) then that's fine.
Yes you got my reasoning right @rgrunber. Let me know if you see any improvements that we should do, otherwise it would be nice to have both of this PRs in master :)
Also, there appear to be some test failures : https://ci.eclipse.org/ls/job/jdt-ls-pr/5176/ . The ones in CompletionHandlerChainTest seem consistent.
@rgrunber did running unit tests method changed recently for JDT.LS tests ? When trying to run the unit tests I get the following error
Required plug-in 'org.eclipse.pde.junit.runtime' could not be found.
PDE definitely wouldn't be in the target platform of JDT-LS, so not sure why it would be needed. It should be part of the platform from which you're launching the plugin-in test though. Maybe you could try clearing any JUnit Plugin Test launch configurations ?
@rgrunber I found that adding the following into the MANIFEST and target platform file in test module to resolve the issue.
org.eclipse.pde.junit.runtime,
org.eclipse.jdt.junit4.runtime
@rgrunber also I found the reason we have the remove snippet text. Without it the tests are failing with following mismatch in Label assertions of the completions
Expected: streams[i].toList() : List<String> Actual : streams[${1:i}].toList() : List<String>
@rgrunber also I found the reason we have the remove snippet text. Without it the tests are failing with following mismatch in Label assertions of the completions
Expected: streams[i].toList() : List Actual : streams[${1:i}].toList() : List
Provided a better fix for this
@rgrunber I found that adding the following into the MANIFEST and target platform file in test module to resolve the issue.
org.eclipse.pde.junit.runtime, org.eclipse.jdt.junit4.runtime
This only needed to be added into target platform.
@rgrunber the failing tests right now testCompletion_Lambda seems pass when I try to run it locally, are there some know random failures like this one in CI ?
@rgrunber did running unit tests method changed recently for JDT.LS tests ? When trying to run the unit tests I get the following error
Required plug-in 'org.eclipse.pde.junit.runtime' could not be found.
If you're using vscode-pde extension to run JUnit plugin test, the latest [email protected] has fixed this issue.
@rgrunber did running unit tests method changed recently for JDT.LS tests ? When trying to run the unit tests I get the following error
Required plug-in 'org.eclipse.pde.junit.runtime' could not be found.If you're using vscode-pde extension to run JUnit plugin test, the latest [email protected] has fixed this issue.
I tried installing, but that gave me some errors on conflicting modules
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.jdt.ls.importer.pde [252]
Unresolved requirement: Require-Bundle: org.eclipse.pde.launching
-> Bundle-SymbolicName: org.eclipse.pde.launching; bundle-version="3.13.0.v20240424-1246"; singleton:="true"
org.eclipse.pde.launching [257]
Unresolved requirement: Require-Bundle: org.eclipse.pde.core; bundle-version="[3.2.0,4.0.0)"
-> Bundle-SymbolicName: org.eclipse.pde.core; bundle-version="3.18.100.v20240531-0649"; singleton:="true"
org.eclipse.pde.core [255]
Unresolved requirement: Import-Package: org.bndtools.versioncontrol.ignores.manager.api; version="[1.0.0,2.0.0)"
Unresolved requirement: Require-Bundle: org.eclipse.m2e.pde.target
-> Bundle-SymbolicName: org.eclipse.m2e.pde.target; bundle-version="2.0.501.20240411-1122"; singleton:="true"
org.eclipse.m2e.pde.target [253]
Unresolved requirement: Require-Bundle: org.eclipse.pde.core; bundle-version="3.14.0"
-> Bundle-SymbolicName: org.eclipse.pde.core; bundle-version="3.18.100.v20240531-0649"; singleton:="true"
Unresolved requirement: Require-Bundle: org.eclipse.pde.core
-> Bundle-SymbolicName: org.eclipse.pde.core; bundle-version="3.18.100.v20240531-0649"; singleton:="true"
at org.eclipse.osgi.container.Module.start(Module.java:493)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:2074)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:143)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2065)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2005)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1968)
at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:274)
at org.eclipse.osgi.container.Module.doStart(Module.java:639)
at org.eclipse.osgi.container.Module.start(Module.java:498)
at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:198)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:463)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:482)
at org.eclipse.osgi.launch.Equinox.start(Equinox.java:139)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:367)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:267)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
at org.eclipse.equinox.launcher.Main.main(Main.java:1454)
[Error - 11:57:34 AM] Aug 10, 2024, 11:57:32 AM FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.m2e.pde.target [253]
Unresolved requirement: Require-Bundle: org.eclipse.pde.core; bundle-version="3.14.0"
-> Bundle-SymbolicName: org.eclipse.pde.core; bundle-version="3.18.100.v20240531-0649"; singleton:="true"
org.eclipse.pde.core [255]
Unresolved requirement: Import-Package: org.bndtools.versioncontrol.ignores.manager.api; version="[1.0.0,2.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:493)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:2074)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:143)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2065)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2005)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1968)
at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:274)
at org.eclipse.osgi.container.Module.doStart(Module.java:639)
at org.eclipse.osgi.container.Module.start(Module.java:498)
at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:198)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:463)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:482)
at org.eclipse.osgi.launch.Equinox.start(Equinox.java:139)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:367)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:267)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
at org.eclipse.equinox.launcher.Main.main(Main.java:1454)
[Error - 11:57:34 AM] Aug 10, 2024, 11:57:32 AM FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.pde.core [255]
Unresolved requirement: Import-Package: org.bndtools.versioncontrol.ignores.manager.api; version="[1.0.0,2.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:493)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:2074)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:143)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2065)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2005)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1968)
at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:274)
at org.eclipse.osgi.container.Module.doStart(Module.java:639)
at org.eclipse.osgi.container.Module.start(Module.java:498)
at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:198)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:463)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:482)
at org.eclipse.osgi.launch.Equinox.start(Equinox.java:139)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:367)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:267)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
at org.eclipse.equinox.launcher.Main.main(Main.java:1454)
[Error - 11:57:34 AM] Aug 10, 2024, 11:57:32 AM FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.pde.launching [257]
Unresolved requirement: Require-Bundle: org.eclipse.pde.core; bundle-version="[3.2.0,4.0.0)"
-> Bundle-SymbolicName: org.eclipse.pde.core; bundle-version="3.18.100.v20240531-0649"; singleton:="true"
org.eclipse.pde.core [255]
Unresolved requirement: Import-Package: org.bndtools.versioncontrol.ignores.manager.api; version="[1.0.0,2.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:493)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:2074)
at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:143)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2065)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:2005)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1968)
at org.eclipse.osgi.container.SystemModule.startWorker(SystemModule.java:274)
at org.eclipse.osgi.container.Module.doStart(Module.java:639)
at org.eclipse.osgi.container.Module.start(Module.java:498)
at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:198)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:463)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:482)
at org.eclipse.osgi.launch.Equinox.start(Equinox.java:139)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:367)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:267)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
at org.eclipse.equinox.launcher.Main.run(Main.java:1481)
at org.eclipse.equinox.launcher.Main.main(Main.java:1454)
[Error - 11:57:34 AM] Aug 10, 2024, 11:57:34 AM Cannot refresh bundle org.eclipse.jdt.ls.core because its dependency closure includes the org.eclipse.jdt.ls.core bundle.
[Error - 11:57:34 AM] Aug 10, 2024, 11:57:34 AM Failed to load extension bundles
Load bundle list
org.eclipse.core.runtime.CoreException: Load bundle list
at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:173)
at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:113)
at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:283)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:128)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:271)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:201)
at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.lambda$1(ParentProcessWatcher.java:144)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Contains: Install bundle failure /Users/gayanperera/.vscode/extensions/vscjava.vscode-java-test-0.42.2024080609/server/org.apiguardian.api_1.1.2.jar
org.osgi.framework.BundleException: A bundle is already installed with the name "org.apiguardian.api" and version "1.1.2"
at org.eclipse.osgi.container.ModuleContainer.install(ModuleContainer.java:451)
at org.eclipse.osgi.storage.Storage.install(Storage.java:754)
at org.eclipse.osgi.internal.framework.BundleContextImpl.installBundle(BundleContextImpl.java:181)
at org.eclipse.osgi.internal.framework.BundleContextImpl.installBundle(BundleContextImpl.java:174)
at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.installBundle(BundleUtils.java:189)
at org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:159)
at org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:113)
at org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:283)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65)
at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:128)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:271)
at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:201)
at org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.lambda$1(ParentProcessWatcher.java:144)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:185)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:97)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:114)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
-> Bundle-SymbolicName: org.eclipse.pde.launching; bundle-version="3.13.0.v20240424-1246"; singleton:="true"
Where did you get the vscode-pde extension? Apparently the pde version you're using does not match what's included in the marketplace version.
See https://github.com/testforstephen/vscode-pde/blob/795f86673ba29f50f7c1f3e09c63d9d155577bfc/package.json#L62, the dependency version it uses is org.eclipse.pde.launching_3.12.0.v20240214-2143.jar.
-> Bundle-SymbolicName: org.eclipse.pde.launching; bundle-version="3.13.0.v20240424-1246"; singleton:="true"Where did you get the vscode-pde extension? Apparently the pde version you're using does not match what's included in the marketplace version.
See https://github.com/testforstephen/vscode-pde/blob/795f86673ba29f50f7c1f3e09c63d9d155577bfc/package.json#L62, the dependency version it uses is
org.eclipse.pde.launching_3.12.0.v20240214-2143.jar.
Strange, i updated it from marketplace. I will try to clear any cached extension files and try installing from marketplace again.
