From 433fee19d173223b204b3ec0f2b59b2e34b53d6f Mon Sep 17 00:00:00 2001 From: Dan Leslie Date: Sun, 11 Nov 2018 22:05:18 -0800 Subject: Much faster completions for Chicken 5; less errors in the log. --- scheme/chicken/geiser/chicken5.scm | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'scheme') diff --git a/scheme/chicken/geiser/chicken5.scm b/scheme/chicken/geiser/chicken5.scm index 4ef110e..6c8ceae 100644 --- a/scheme/chicken/geiser/chicken5.scm +++ b/scheme/chicken/geiser/chicken5.scm @@ -140,15 +140,13 @@ (write-to-log out-form)) (newline))) - - (define (read* str) - (with-input-from-string str (lambda () (read)))) (define (eval* str) - (cond - ((symbol? str) (eval str)) - ((string? str) (eval (read* str))) - (else #f))) + (handle-exceptions exn #f + (with-all-output-to-string + (eval + (with-input-from-string (->string str) + (lambda () (read))))))) (define (fmt node) (let* ((mod (cadr node)) @@ -160,7 +158,9 @@ `(,sym ("args" (("required" ) ("optional" ...) ("key"))) - ("module"))) + ,(if (and mod) + (cons "module" mod) + (list "module")))) ((or (equal? 'variable type) (equal? 'constant type)) `(,sym ("value" . ,(eval* sym)))) @@ -197,7 +197,9 @@ `(,sym ("args" (("required" ,@reqs) ("optional" ,@opts) ("key" ,@keys))) - ("module"))))))) + ,(if (and mod) + (cons "module" mod) + (list "module")))))))) ;; Builds a signature list from an identifier (define (find-signatures sym) @@ -277,14 +279,13 @@ (define (geiser-autodoc ids . rest) (cond - ((null? ids) '()) - ((not (list? ids)) - (geiser-autodoc (list ids))) - (else - (let ((details (find-signatures (car ids)))) - (if (null? details) - (geiser-autodoc (cdr ids)) - details))))) + ((null? ids) #f) + ((symbol? ids) + (find-signatures ids)) + ((list? ids) + (let ((first (find-signatures (car ids)))) + (if first first (geiser-autodoc (cdr ids))))) + (else #f))) (define (geiser-object-signature name object . rest) (let* ((sig (geiser-autodoc `(,name)))) -- cgit v1.2.3