zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Eric Cook <llua@gmx.com>
Cc: zsh-workers@zsh.org
Subject: Re: clang completion
Date: Sun, 08 Jul 2018 23:34:07 +0200	[thread overview]
Message-ID: <3925.1531085647@thecus> (raw)
In-Reply-To: <c335a271-cf49-2d91-d684-f285d040835a@gmx.com>

Eric Cook wrote:
> > This sort of design tends to follow from the way bash programmable
> > completion is designed. I'd far prefer to have clear options for listing
> > all warnings, languages, options etc. Those potentially have wider uses.
> > 
>
> Do you mind further expanding upon this? so people considering this option
> can be directed to a location of why this may not be desired for other shells.

For a useful link to which we can refer people, some tidying and editing
work might be needed.

In bash, a function adds matches to the COMP_REPLY array. You can get
bash to do matching with compgen -W but clang has saved you the trouble:
clang --autocomplete='-fv' will only list options starting with -fv.
Firstly, we don't want matching done for us that way.

gcc has various forms of --help that provide a good example of the sort
of thing I was suggesting, e.g. gcc --help=target, --help=params and
--help=warnings. Perhaps an additional option could force these into a
more parsable match:description format with no headers/footers or word
wrapping.

Where it is useful for a command to parse the command-line for us, I'd
be happy with getting back a list of tags and offsets for how much of
the prefix and suffix should be ignored. So after -std= it might for
example, return standards:5:0 to tell you to complete standards after
stripping 5 characters of prefix and 0 of suffix. For the general case,
it might return more than one of these. We'd want all the tags
documented and they might be something like "files" that we already
complete some other way. The interface for that should not do weird
stuff with commas like clang. One idea would be to pass the word offset
followed by the character offset of the cursor followed by all words
(prefix and suffix). But, I'm not sure how well something like that
would really work in practice.

Oliver


  reply	other threads:[~2018-07-08 21:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-30  8:34 Eitan Adler
2018-07-07 20:57 ` Matthew Martin
2018-07-08  6:40   ` Daniel Shahaf
2018-07-08 12:40     ` Oliver Kiddle
2018-07-08 14:02       ` Eric Cook
2018-07-08 21:34         ` Oliver Kiddle [this message]
2018-07-09 10:19           ` Daniel Shahaf

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=3925.1531085647@thecus \
    --to=okiddle@yahoo.co.uk \
    --cc=llua@gmx.com \
    --cc=zsh-workers@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).