Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Java completion for Java files
- X-seq: zsh-users 29640
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Henri Tremblay <henri.tremblay@xxxxxxxxx>
- Cc: zsh-users@xxxxxxx
- Subject: Re: Java completion for Java files
- Date: Mon, 5 Feb 2024 12:43:51 -0800
- Archived-at: <https://zsh.org/users/29640>
- In-reply-to: <CADZL2=u-c69DmGyWFNMhYRCR0NQ3DtZv9DbuMSGK+iFT6t5ASQ@mail.gmail.com>
- List-id: <zsh-users.zsh.org>
- References: <CADZL2=u-c69DmGyWFNMhYRCR0NQ3DtZv9DbuMSGK+iFT6t5ASQ@mail.gmail.com>
On Mon, Feb 5, 2024 at 10:04 AM Henri Tremblay <henri.tremblay@xxxxxxxxx> wrote:
>
> Java now supports (since Java 10 I think) command lines like
>
> java Math.java
>
> It will then just compile and launch that java file. But zsh won't autocomplete for that. It only wants a jar, class file or whatever.
The issue is here in the _arguments setup for _java:
'(-):class:_java_class -m main ${(kv)opt_args[(i)(-classpath|-cp)]}' \
'*::args:= _normal' \
&& return 0
The (-) says that the first word after "java" must either be an option
(start with "-") or must be a class name. The completion stops there
unless working on the next word.
How does "java" itself distinguish between a class name and a file
name? Just whether the string ends in ".java"?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author