This commit is contained in:
Martin Tournoij 2024-07-31 03:39:59 +05:30 committed by GitHub
commit 2382f9aeaa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 2 deletions

View File

@ -43,6 +43,18 @@
# * Go authors
#
# ------------------------------------------------------------------------------
# Notes
# -----
#
# * To disable listing packages from GOROOT (i.e. Go stdlib) in completions use:
#
# zstyle ':completion:*:go:*' no-goroot true
#
# * To disable listing packages from GOPATH in completions use:
#
# zstyle ':completion:*:go:*' no-gopath true
#
# ------------------------------------------------------------------------------
__go_buildmodes() {
local -a buildmodes=(
@ -384,11 +396,16 @@ case $state in
__go_packages() {
local gopaths
declare -a gopaths
gopaths=("${(s/:/)$(go env GOPATH)}")
gopaths+=("$(go env GOROOT)")
if ! zstyle -t ":completion:${curcontext}:" no-gopath; then
gopaths=("${(s/:/)$(go env GOPATH)}")
fi
if ! zstyle -t ":completion:${curcontext}:" no-goroot; then
gopaths+=("$(go env GOROOT)")
fi
for p in $gopaths; do
_path_files $@ -W "$p/src" -/
done
# no special treatment for
# - relative paths starting with ..
# - absolute path starting with /