zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Henri Tremblay <henri.tremblay@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: Java completion for Java files
Date: Mon, 5 Feb 2024 12:43:51 -0800	[thread overview]
Message-ID: <CAH+w=7ZypOKPcqLBL57+_unK-UFKky9X3y7LKiNdyOCv2PnJfQ@mail.gmail.com> (raw)
In-Reply-To: <CADZL2=u-c69DmGyWFNMhYRCR0NQ3DtZv9DbuMSGK+iFT6t5ASQ@mail.gmail.com>

On Mon, Feb 5, 2024 at 10:04 AM Henri Tremblay <henri.tremblay@gmail.com> 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"?


  reply	other threads:[~2024-02-05 20:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 18:04 Henri Tremblay
2024-02-05 20:43 ` Bart Schaefer [this message]
2024-02-06  2:47   ` Henri Tremblay
2024-02-06 10:23     ` Michal Politowski
2024-02-07 16:15       ` Henri Tremblay

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAH+w=7ZypOKPcqLBL57+_unK-UFKky9X3y7LKiNdyOCv2PnJfQ@mail.gmail.com' \
    --to=schaefer@brasslantern.com \
    --cc=henri.tremblay@gmail.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).