summaryrefslogtreecommitdiffstats
path: root/parser.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-10 06:30:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-10 06:30:05 -0700
commit2860d81328d3a966a1c3a1df013b51404ecc71b9 (patch)
tree7a0b5b6dce3cc2293ccda8b4a608dfbcec98bd4c /parser.c
parentee3ed33801eeb1472ea54051a8fa59653a11baae (diff)
downloadtxr-2860d81328d3a966a1c3a1df013b51404ecc71b9.tar.gz
txr-2860d81328d3a966a1c3a1df013b51404ecc71b9.tar.bz2
txr-2860d81328d3a966a1c3a1df013b51404ecc71b9.zip
Completion doesn't iterate over all packages.
When the completed symbol is unqualified, let's not complete across all packages, but just the user package. * parser.c (provide_completions): Substitute user_package if package is null, and call find_matching_syms once rather than iterating on all packages. Also, in this case, do not request symbol qualification.
Diffstat (limited to 'parser.c')
-rw-r--r--parser.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/parser.c b/parser.c
index a958104f..c6f030f8 100644
--- a/parser.c
+++ b/parser.c
@@ -480,6 +480,7 @@ static void provide_completions(const char *data,
line_pfxu8[lsz - 1] = 0;
{
+ uses_or2;
val line_pfx = string_utf8(line_pfxu8);
char prev = (end > data) ? end[-1] : 0;
char pprev = (end > data + 1) ? end[-2] : 0;
@@ -487,16 +488,8 @@ static void provide_completions(const char *data,
int dwim = (prev == '[');
char par = (!pprev || !quote || dwim) ? prev : 0;
- if (package) {
- find_matching_syms(cpl, package, sym_pfx, line_pfx, par, null(keyword));
- } else {
- val pa;
-
- for (pa = package_alist(); pa; pa = cdr(pa)) {
- val pair = car(pa);
- find_matching_syms(cpl, cdr(pair), sym_pfx, line_pfx, par, nil);
- }
- }
+ find_matching_syms(cpl, or2(package, user_package),
+ sym_pfx, line_pfx, par, if2(package, null(keyword)));
}
}
}