summaryrefslogtreecommitdiff
path: root/scheme/chicken
diff options
context:
space:
mode:
authordieggsy <dieggsy@protonmail.com>2019-06-20 03:27:46 -0400
committerdieggsy <dieggsy@protonmail.com>2019-06-20 03:33:43 -0400
commit5dc8efd319f305e4322269ebc9d7836cb1c23764 (patch)
tree9d7fbb5b42bb13320492868d562fd8464108f87d /scheme/chicken
parent25b4eafe82be36905aa43dc32a38ba65a43e5200 (diff)
downloadgeiser-guile-5dc8efd319f305e4322269ebc9d7836cb1c23764.tar.gz
geiser-guile-5dc8efd319f305e4322269ebc9d7836cb1c23764.tar.bz2
More accurate Chicken completions, inspired by breadline
- Fixes #276
Diffstat (limited to 'scheme/chicken')
-rw-r--r--scheme/chicken/geiser/chicken5.scm17
1 files changed, 14 insertions, 3 deletions
diff --git a/scheme/chicken/geiser/chicken5.scm b/scheme/chicken/geiser/chicken5.scm
index 5409058..6b449df 100644
--- a/scheme/chicken/geiser/chicken5.scm
+++ b/scheme/chicken/geiser/chicken5.scm
@@ -276,10 +276,21 @@
;; Completions, Autodoc and Signature
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ (define (current-environment-completions prefix)
+ (let ((size (string-length prefix)))
+ (filter
+ (lambda (candidate) (substring=? prefix candidate 0 0 size))
+ (map (o symbol->string car) (##sys#current-environment)))))
+
+ (define (apropos-completions prefix)
+ (let ((candidates (apropos-list `(: bos ,prefix) #:macros? #t)))
+ (remove
+ (lambda (candidate) (substring-index "#" candidate))
+ (map symbol->string candidates))))
+
(define (geiser-completions prefix . rest)
- (let ((prefix (->string prefix)))
- (filter (cut string-has-prefix? <> prefix)
- (map ->string (map car (symbol-information-list prefix))))))
+ (append (apropos-completions prefix)
+ (current-environment-completions prefix)))
(define (geiser-module-completions prefix . rest)
'())