summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-03-21 06:22:42 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-03-21 06:22:42 -0700
commit7e2f1500f34098be4a0cc0b2130cffb3a729793b (patch)
tree18e9a0b5e4136d8379f583fdd2069748f6648ac8 /lib.c
parentc2dec325d87de8be8917e7b52f118f4664a9e13a (diff)
downloadtxr-7e2f1500f34098be4a0cc0b2130cffb3a729793b.tar.gz
txr-7e2f1500f34098be4a0cc0b2130cffb3a729793b.tar.bz2
txr-7e2f1500f34098be4a0cc0b2130cffb3a729793b.zip
listener: completion sensitive for slots and methods.
When completing .prefix[TAB], .(prefix[TAB] or .[prefix[TAB], restrict identifiers to the appropriate namespace. The former will report only symbols from the relevant package which are struct slots; the latter further restricts it to those which are static slots defined as functions. * lib.c (symbol_visible): Static function becomes extern. * lib.h (symbol_visible): Declared. * parser.c (find_matching_syms): par parameter is renamed kind and can hold additional values 'S' (slots) and 'M' (methods). New get_slot_syms function is used to fetch the slots, as necessary, instead of the visible syms, if the kind is 'S' or 'M'. The same loop as before (with the minor change of recognizing 'S' and 'M' also) performs the prefix matching. (provide_completions): Recognize . .( and .[ prefix, calculating the kind argument of find_matching_syms in a new way. * struct.c (get_slot_syms): New function. * struct.h (get_slot_syms): Declared. * txr.1: Add some notes about this under the description of completion. The full rules are not given though; let the user discover.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib.c b/lib.c
index 5d2724fe..e578b308 100644
--- a/lib.c
+++ b/lib.c
@@ -5053,7 +5053,10 @@ val unuse_package(val unuse_list, val package_in)
return unuse_package_list;
}
-static val symbol_visible(val package, val sym)
+/* symbol_visible assumes the perspective that package
+ * is the current package!
+ */
+val symbol_visible(val package, val sym)
{
val name = symbol_name(sym);
type_check (package, PKG);