Skip to content

Add project-only reference search scope - #3850

Merged
datho7561 merged 6 commits into
eclipse-jdtls:mainfrom
mielientiev:feature/project-only-search-scope
Aug 12, 2026
Merged

Add project-only reference search scope#3850
datho7561 merged 6 commits into
eclipse-jdtls:mainfrom
mielientiev:feature/project-only-search-scope

Conversation

@mielientiev

Copy link
Copy Markdown
Contributor

Fixes #3821.

When projectOnly is enabled, reference searches include workspace sources, tests, and referenced projects, while excluding external libraries and the JDK. The existing behavior remains unchanged by default.

In a small project benchmark, some reference searches were approximately 5x to 15x faster:

  • all: ~27.4s
  • projectOnly: ~1.9s
  • Speedup: ~14.5x

@eclipse-ls-bot

Copy link
Copy Markdown
Contributor

Can one of the admins verify this patch?

@angelozerr

Copy link
Copy Markdown

That's super great @mielientiev ! Thanks so much to have worked on this issue. It will speed up the MCP Server that I am working on it.

@angelozerr

Copy link
Copy Markdown

@datho7561 please review the PR. Thanks!

@datho7561

Copy link
Copy Markdown
Contributor

@angelozerr were you hoping for the new scope to be used anywhere, or were you planning on doing that yourself somewhere through an extension?

@angelozerr

Copy link
Copy Markdown

No I would like to use JDT.LS. My plan is to manage settings.json like vscode does to call JDT.LS with vscode java settings.

In other words if user will set settings.json with projectOnly (for their project in vscode), my JDT.LS wiill use it.

@datho7561 datho7561 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and tests pass. The search scope currently isn't being used anywhere outside of the tests, so I'd appreciate a follow up from Angelo for what his specific plan is.

@mielientiev Do you mind signing the ECA? Unfortunately, we can't accept the PR until you've done that.

@angelozerr

Copy link
Copy Markdown

The search scope currently isn't being used anywhere outside of the tests, so I'd appreciate a follow up from Angelo for what his specific plan is.

When this PR will be merged, is there a way to download jdtls with this feature?

@datho7561

Copy link
Copy Markdown
Contributor

When this PR will be merged, is there a way to download jdtls with this feature?

There will be a nightly build here: https://download.eclipse.org/jdtls/snapshots

@angelozerr

Copy link
Copy Markdown

When this PR will be merged, is there a way to download jdtls with this feature?

There will be a nightly build here: https://download.eclipse.org/jdtls/snapshots

That's super great! Once it will be available I will try it and give you feedback. Thanks @datho7561 !

@mielientiev

Copy link
Copy Markdown
Contributor Author

@datho7561 done!

@datho7561
datho7561 self-requested a review July 17, 2026 20:53
@mielientiev

Copy link
Copy Markdown
Contributor Author

@datho7561 please review when you have time

@datho7561 datho7561 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry it took so long to review properly. It's looking pretty good, and it's a very good performance boost for eg. looking for all occurances of System.out.println in a project. Found another spot where I think it'd be helpful to apply the setting.

I'll put up a quick PR in vscode-java for the client side changes necessary to adopt this, which should make it easier to try out for anyone whose curious.

@mielientiev
mielientiev requested a review from datho7561 August 10, 2026 13:30
@robstryker

Copy link
Copy Markdown
Contributor

The most recent commit looks reasonable to me, but, I'm not as familiar with this project and @datho7561 is busy today. Looks safe enough to trigger the workflows.

@shin19991207 If you're not busy, feel free to comment if the most recent commit looks reasonable.

@shin19991207

Copy link
Copy Markdown
Contributor

I think this PR addresses the original issue, and the changes look good to me. I'm +1 on it. I'm also not deeply familiar with this project either 😄, though, so it may still be worth waiting for David’s review?

@datho7561 datho7561 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks, Ihor!

@datho7561
datho7561 merged commit 91f75a0 into eclipse-jdtls:main Aug 12, 2026
7 checks passed
datho7561 added a commit to datho7561/vscode-java that referenced this pull request Aug 12, 2026
See eclipse-jdtls/eclipse.jdt.ls#3850,
this is the client side changes needed to adopt that PR.

Signed-off-by: David Thompson <davthomp@redhat.com>
datho7561 added a commit to redhat-developer/vscode-java that referenced this pull request Aug 12, 2026
See eclipse-jdtls/eclipse.jdt.ls#3850,
this is the client side changes needed to adopt that PR.

Signed-off-by: David Thompson <davthomp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "projectOnly" scope to java.search.scope setting to exclude JDK and library references

6 participants