* [PATCH] _java: fix completion when $CLASSPATH contains empty entries
@ 2010-11-06 9:38 Mikael Magnusson
0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2010-11-06 9:38 UTC (permalink / raw)
To: zsh workers
Treat them as a . instead of a / as this is what java does.
---
jure_ on #zsh noticed that zsh took very long to complete class names, turns out
he had a trailing : in his $CLASSPATH. A quick test shows that java treats these
as a ., not a /, though this does not appear to be documented anywhere.
Completion/Unix/Type/_java_class | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Completion/Unix/Type/_java_class b/Completion/Unix/Type/_java_class
index d81669c..0201288 100644
--- a/Completion/Unix/Type/_java_class
+++ b/Completion/Unix/Type/_java_class
@@ -13,9 +13,10 @@ classpath="${${classpath[2]:-${CLASSPATH:-.}}//\\:/:}"
: "$classpath[@]"
for i in "${(s.:.)classpath}"; do
- if [ -f $i ] && [[ "$i" == *.(jar|zip|war|ear) ]]; then
+ [[ -z $i ]] && i=.
+ if [[ -f $i ]] && [[ "$i" == *.(jar|zip|war|ear) ]]; then
c+=( ${${${(M)$(_call_program jar_classes jar -tf
$i)##*.class}%%.class}:gs#/#.#} )
- elif [ -d $i ]; then
+ elif [[ -d $i ]]; then
c+=( $i/**/*.class(.:r:s/.class//:s#$i/##:gs#/#.#) )
fi
done
--
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] _java: fix completion when $CLASSPATH contains empty entries
@ 2010-11-06 9:40 Mikael Magnusson
0 siblings, 0 replies; 2+ messages in thread
From: Mikael Magnusson @ 2010-11-06 9:40 UTC (permalink / raw)
To: zsh workers
Treat them as a . instead of a / as this is what java does.
---
jure_ on #zsh noticed that zsh took very long to complete class names, turns out
he had a trailing : in his $CLASSPATH. A quick test shows that java treats these
as a ., not a /, though this does not appear to be documented anywhere.
Completion/Unix/Type/_java_class | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Completion/Unix/Type/_java_class b/Completion/Unix/Type/_java_class
index d81669c..0201288 100644
--- a/Completion/Unix/Type/_java_class
+++ b/Completion/Unix/Type/_java_class
@@ -13,9 +13,10 @@ classpath="${${classpath[2]:-${CLASSPATH:-.}}//\\:/:}"
: "$classpath[@]"
for i in "${(s.:.)classpath}"; do
- if [ -f $i ] && [[ "$i" == *.(jar|zip|war|ear) ]]; then
+ [[ -z $i ]] && i=.
+ if [[ -f $i ]] && [[ "$i" == *.(jar|zip|war|ear) ]]; then
c+=( ${${${(M)$(_call_program jar_classes jar -tf
$i)##*.class}%%.class}:gs#/#.#} )
- elif [ -d $i ]; then
+ elif [[ -d $i ]]; then
c+=( $i/**/*.class(.:r:s/.class//:s#$i/##:gs#/#.#) )
fi
done
--
1.7.3
--
Mikael Magnusson
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-11-06 9:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-06 9:38 [PATCH] _java: fix completion when $CLASSPATH contains empty entries Mikael Magnusson
2010-11-06 9:40 Mikael Magnusson
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).