Skip to content

feat: let embedders search only the sealed class's package for inheritors - #5

Merged
itsaky-adfa merged 1 commit into
mainfrom
feat/ADFA-6857-same-package-inheritors
Nov 10, 2026
Merged

itsaky-adfa merged 1 commit into
mainfrom
feat/ADFA-6857-same-package-inheritors

Conversation

@itsaky-adfa

Copy link
Copy Markdown
Collaborator

LLSealedInheritorsProvider asks KotlinDirectInheritorsProvider.getDirectKotlinInheritors for every inheritor in the module, then keeps only those in the sealed class's package. In CodeOnTheGo the full search parses every source file on each call. Searching only the package cut the first completion after a cold open from 26.9 s to 14.5 s on a moto g34.

This patch:

  • adds KotlinDirectInheritorsProvider.getSamePackageDirectKotlinInheritors, a default method that filters getDirectKotlinInheritors to the base class's package;
  • makes LLSealedInheritorsProvider call it, instead of filtering itself.

With the default, behaviour is unchanged. An embedder that can list a package's files overrides it; getDirectKotlinInheritors keeps its "all inheritors in scope" contract.

Adds patches/0012-feat-let-embedders-search-only-the-sealed-class-s-pa.patch. Patches 0001-0011 are unchanged.

Built locally on 2.3.20 with patches 0001-0012. javap shows the default method and LLSealedInheritorsProvider calling it. CoGo's :lsp:kotlin unit tests: 653/653 with the override in use (ADFA-6857).

@itsaky-adfa itsaky-adfa self-assigned this Nov 10, 2026
@itsaky-adfa
itsaky-adfa merged commit b006e8c into main Nov 10, 2026
4 checks passed
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.

1 participant