Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Improvements to the gcc completion script
- X-seq: zsh-workers 48187
- From: Jun T <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Improvements to the gcc completion script
- Date: Fri, 19 Mar 2021 12:51:45 +0900
- Archived-at: <https://zsh.org/workers/48187>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2021-03/AC21C9E9-1941-46D4-80D6-89CFA0DE4D97%40kba.biglobe.ne.jp>
- In-reply-to: <A8DE403C-E92F-47AD-A65B-239D55156367@gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <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@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author