Java (eclipse_jdtls): don't hard-ignore packages named dist/lib/classes/out (#1645)

EclipseJDTLS.is_ignored_dirname hard-ignored directories named target/build/bin/out/classes/dist/lib. Several of these (dist, lib, classes, out) are valid Java package identifiers, so any source file whose package path contained one was dropped from directory traversal and became invisible to the symbol tools (find_symbol, get_symbols_overview, find_referencing_symbols) even when git check-ignore reported nothing.

Per maintainer guidance in #1645, remove the override entirely: the base is_ignored_dirname already skips _ALWAYS_IGNORED_DIRS (VCS/venv/cache/IDE internals), and real build output is already excluded via .gitignore, so the hardcoded list was both redundant and harmful.

Adds a regression test (no Java/JDTLS process required) that fails on main and asserts the formerly-hardcoded names are no longer ignored while _ALWAYS_IGNORED_DIRS still are.
This commit is contained in:
AmirF194 committed 2026-07-06 15:32:51 -06:00
1 parent f6b6efa65b
commit e08dfc7133
3 files changed
+33 -18

No files matched your search

@@ -615,3 +615,32 @@ class TestComputeWorkspaceHash:
configured_hash = EclipseJDTLS.DependencyProvider._compute_workspace_hash(self.REPO, self.DEFAULT_LAUNCHER, settings)
assert configured_hash != legacy_hash
# ----------------------------------------------------------------------------
# is_ignored_dirname (directory-traversal filter)
# ----------------------------------------------------------------------------
class TestIsIgnoredDirname:
"""Regression for #1645: the Java language server must not hard-ignore directories whose names
collide with build-tool output (``lib``, ``dist``, ``classes``, ``out``, ...). Those are all
valid Java package identifiers, so ignoring them by name hid legitimate source from the symbol
tools even when ``git check-ignore`` reported nothing. Real build output is already filtered via
``.gitignore``, so directory traversal should only skip the language-agnostic
``_ALWAYS_IGNORED_DIRS`` (VCS/venv/cache/IDE internals) inherited from the base language server.
"""
@pytest.fixture
def jdtls(self) -> EclipseJDTLS:
# is_ignored_dirname only reads the class-level _ALWAYS_IGNORED_DIRS, so an uninitialized
# instance is sufficient here (no Java or JDTLS process required).
return object.__new__(EclipseJDTLS)
@pytest.mark.parametrize("dirname", ["lib", "dist", "classes", "out", "target", "build", "bin"])
def test_valid_package_dirnames_are_not_ignored(self, jdtls: EclipseJDTLS, dirname: str) -> None:
assert jdtls.is_ignored_dirname(dirname) is False
@pytest.mark.parametrize("dirname", [".git", ".venv", ".idea", ".serena", ".mypy_cache"])
def test_always_ignored_dirs_are_still_ignored(self, jdtls: EclipseJDTLS, dirname: str) -> None:
assert jdtls.is_ignored_dirname(dirname) is True