zsh-workers
 help / color / mirror / code / Atom feed
From: Jun T <takimoto-j@kba.biglobe.ne.jp>
To: zsh-workers@zsh.org
Subject: Re: Improvements to the gcc completion script
Date: Fri, 19 Mar 2021 12:51:45 +0900	[thread overview]
Message-ID: <AC21C9E9-1941-46D4-80D6-89CFA0DE4D97@kba.biglobe.ne.jp> (raw)
In-Reply-To: <A8DE403C-E92F-47AD-A65B-239D55156367@gmail.com>

Thank you for lots of improvements!

Please consider the following points (some of them already existed
before your improvements):


In args for clang (line 509 and below), there are several duplicated options
such as -fshow-source-location, -lazy_framework, etc.

Some options (such as -fauto-profile) can take optional argument.
For these, it would be better to use
--fauto-profile=-::message:action
instead of duplicating it with and without arg.


> 2021/03/12 13:07, Jacob Gelbman <gelbman@gmail.com> wrote:

> The current completion for the argument of -l wouldn't work if the $LD_LIBRARY_PATH had more than one path in it, because paths are separated by : traditionally in that variable, so I made sure completion works if there are :'s in it. Also I added /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib to the default path since that's the one macOS uses.

I think LD_LIBRARY_PATH is not used at link time (it is used only at run time),
and we can ignore it when completing libraries ( -l<TAB> ). Is this correct?

TODO (you can left this for someone else):
Add directories specified by -L/path/to/dir on the command line to library_path.


> Added the -framework option, and completed the names of frameworks it can take. frameworks are macOS's style of library.

-F, -iframework and -iframeworkwithsysroot can be specified multiple times.
Please use '*-F' etc for optspec.
For -iframework you can use '_files -/' as action (like -F).
# -iframeworkwithsysroot is meaningful only with -isysroot, and, ideally,
# '-iframeworkwithsysroot <TAB>' should offer directory relative to isysroot.
# But I think such an elaboration would not be necessary.

-framework, -lazy_framework and -weak_framework can also be specified multiple times.
The latter two can use '->framework' as action (as -framework).

It would be better to include Framework-related stuff only if '$OSTYPE = darwin*'.

I don't have any detailed knowledge of how Apple's command line tools work,
but probably it would better to use the output of 'xcrun --show-sdk-path' instead of 
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk.

TODO: Add directory specified by -F/path/to/dir to framework_path

> I changed the input file type because sometimes it's useful to include library files on the command line, and these have extensions .so*, .a, .dylib, or even with no extension like in mac's frameworks. I thought it better if it just completed all files and not just .c, .cpp, .m, etc.

I believe most users will not like this. Instead, please use something like 
zstyle ':completion:*:*:gcc:argument-rest:*' file-patterns '*'
for your personal customization.


> I removed the matchspec "r:|[_-]=*" from the _arguments call because there were certain options where I would try to complete them, and they positioned the cursor elsewhere unexpectedly. for example, I wrote "clang --opt<tab>" and after it completed up until --optimiz, it positioned me on the second - when I expected to be at the end of the fully completed option, --optimize=. also it didn't fully complete, it left it at --optimiz.

I can't reproduce your problem.
The matcher 'r:|[_-]=*' is quite useful and better not to be removed since it allows
gcc -fd-s-l<TAB>
to be completed to
gcc -fdiagnostics-show-location=


> I added a completion for arguments to -Werror= ... (snip)

Thanks. I think -Werror can also be specified multiple times ('*-Werror=-').

----
Jun

  reply	other threads:[~2021-03-19  3:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12  4:07 Jacob Gelbman
2021-03-19  3:51 ` Jun T [this message]
2021-03-22  2:28   ` Jacob Gelbman
2021-03-22  2:29     ` Jacob Gelbman
2021-03-22 15:18     ` Jun. T
2021-03-31 12:31       ` Oliver Kiddle
2021-03-31 14:53         ` Jun. T
2021-03-31 15:06           ` Jun. T
2021-03-31 18:37             ` two anchor forms of matching control (was Re: Improvements to the gcc completion script) Oliver Kiddle

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=AC21C9E9-1941-46D4-80D6-89CFA0DE4D97@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --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).