RFR: 8366691: JShell should support a more convenient completion

Jan Lahoda jlahoda at openjdk.org
Tue Oct 21 11:15:54 UTC 2025


JShell tool has the code completion feature in the terminal, allowing to tab-complete inputs. The JShell engine also has an API to compute the completions. But, the API is more suitable for a terminal-based UI, not for a GUI.

The goal in this PR is to provide an API that would allow better code completions in GUI frontends for JShell.

The main idea here is that the user of the API will get information could the context and `Element` that can continue the current input, and can produce UI elements/strings out of this information as necessary.

The apidiff for the current API is available here:
https://cr.openjdk.org/~jlahoda/8366691/JDK-8366691.00/

-------------

Commit messages:
 - Fixing test
 - Adding test for the active parameter.
 - Adding parameter index.
 - Merge branch 'master' into JDK-8366691
 - Merge branch 'JDK-8368848' into JDK-8366691
 - 8368848: JShell's code completion not always working for multi-snippet inputs
 - Ability to get real type.
 - Fixing(?) anchor.
 - Merge branch 'master' into JDK-8366691
 - Fixing tests.
 - ... and 22 more: https://git.openjdk.org/jdk/compare/dfd38322...084654a9

Changes: https://git.openjdk.org/jdk/pull/27049/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27049&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8366691
  Stats: 954 lines in 8 files changed: 792 ins; 73 del; 89 mod
  Patch: https://git.openjdk.org/jdk/pull/27049.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27049/head:pull/27049

PR: https://git.openjdk.org/jdk/pull/27049


More information about the compiler-dev mailing list