summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-08 06:11:54 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-08 06:11:54 -0700
commit29b21813ed8f6a8d166286e71bdd7d2e30af74bf (patch)
tree759a2c18a9901a34b0d09e3179499e5dfe2604e0
parentf06a41a9d806b0d49550ddf6072ebb195dec854a (diff)
downloadtxr-29b21813ed8f6a8d166286e71bdd7d2e30af74bf.tar.gz
txr-29b21813ed8f6a8d166286e71bdd7d2e30af74bf.tar.bz2
txr-29b21813ed8f6a8d166286e71bdd7d2e30af74bf.zip
listener: completion: wrong use of package fallback.
The problem is that completion on pub:sym[Tab] is completing on the fallback list, because pub is the current package. If we type pub:l[Tab], we might complete to pub:list. But that's because usr:list was found in the fallbacklist; pub:list isn't that symbol, and its use will shadow usr:list. This is against the documentatiion too, which describes it the way it should work: simply that the fallback list of the current package is used under completion when no package qualifier prefix is present. * parser.c (get_visible_syms): Rename second parameter to reflect its actual meaning, rather than an original intended use. (find_matching_syms): Only allow get_visible_syms to traverse package fallback lists if qualify is false. Thus even if we are completing against the current package, if that package is being explicitly indicated with a prefix, then only the package local symbols are included.
-rw-r--r--parser.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/parser.c b/parser.c
index 82576f43..237860c8 100644
--- a/parser.c
+++ b/parser.c
@@ -710,11 +710,11 @@ static void load_rcfile(val name)
uw_catch_end;
}
-static val get_visible_syms(val package, int is_cur)
+static val get_visible_syms(val package, int include_fallback)
{
val fblist;
- if (!is_cur || nilp((fblist = package_fallback_list(package)))) {
+ if (!include_fallback || nilp((fblist = package_fallback_list(package)))) {
return package_symbols(package);
} else {
val symhash = copy_hash(package->pk.symhash);
@@ -748,7 +748,7 @@ static void find_matching_syms(lino_completions_t *cpl,
package_name(package)));
val syms = ((kind == 'S' || kind == 'M')
? hash_keys((get_slot_syms(package, is_cur, tnil(kind == 'M'))))
- : get_visible_syms(package, is_cur != nil));
+ : get_visible_syms(package, is_cur != nil && !qualify));
for ( ; syms; syms = cdr(syms)) {
val sym = car(syms);