zsh-workers
 help / color / mirror / code / Atom feed
From: Matthew Martin <phy1729@gmail.com>
To: zsh-workers@zsh.org
Subject: Re: clang completion
Date: Sat, 7 Jul 2018 15:57:51 -0500	[thread overview]
Message-ID: <20180707205750.GA62923@CptOrmolo.darkstar> (raw)
In-Reply-To: <CAF6rxgk2uiZ1wxHYtVKEZO=b4Voitz9sB8jU1ta1Evxv78FU-A@mail.gmail.com>

On Sat, Jun 30, 2018 at 01:34:02AM -0700, Eitan Adler wrote:
> Hey all,
> 
> I just discovered this feature of clang but unfortunately lack the
> time to properly sort this out:
> 
> http://blog.llvm.org/2017/09/clang-bash-better-auto-completion-is.html'
> 
> ∴clang --autocomplete='-tr'
> -traditional-cpp Enable some traditional CPP emulation
> -trigraphs Process trigraph sequences
> 
> ∴clang --autocomplete='-std=,c++0'
> c++03
> c++0x
> and so on
> 
> It seems easy enough to use. Maybe its time to give clang its own completer?
> gcc might also be thinking of doing something similar
> https://gcc.gnu.org/ml/gcc/2018-04/msg00148.html ?

Proof of concept completer:

#compdef clang

local -a options=(${${${(f)"$(_call_program clang clang --autocomplete=${words[CURRENT]/=/\=,})"}//:/\\:}/$'\t'/:})
compset -P '*='
_describe options options

The issue is I'm not sure what format --autocomplete expects. It seems
to want commas after the first = as in the -std example, but what about
if there's more =s or if there's a comma in an argument?  I didn't find
docs with a quick search nor did I get a response from #llvm. If anyone
knows where --autocomplete docs are, those would be most helpful. I've
avoided reading the bash completer to avoid GPL taint.

I believe there were also concerns that clang cannot be split from gcc
and cc since clang is cc sometimes (for instance on OpenBSD for some
architectures).

- Matthew Martin


  reply	other threads:[~2018-07-07 20:57 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 [this message]
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
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=20180707205750.GA62923@CptOrmolo.darkstar \
    --to=phy1729@gmail.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).