diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-05-11 01:51:09 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-05-11 01:51:09 +0200 |
commit | 2696effa0a69fbba33142f2842e4e2523e485109 (patch) | |
tree | a83eb8b8975ead954ce2bf2a00467ace1f0053ed | |
parent | 4e1bfdb594e5606f68a41e280c75776e2fb0917e (diff) | |
download | geiser-chez-2696effa0a69fbba33142f2842e4e2523e485109.tar.gz geiser-chez-2696effa0a69fbba33142f2842e4e2523e485109.tar.bz2 |
PLT: fixes for module name completion.
-rw-r--r-- | scheme/plt/geiser.ss | 6 | ||||
-rw-r--r-- | scheme/plt/geiser/completions.ss | 25 |
2 files changed, 19 insertions, 12 deletions
diff --git a/scheme/plt/geiser.ss b/scheme/plt/geiser.ss index 8d1a249..e619919 100644 --- a/scheme/plt/geiser.ss +++ b/scheme/plt/geiser.ss @@ -31,7 +31,7 @@ geiser/compile-file geiser/macroexpand geiser/completions - geiser/all-modules + geiser/module-completions geiser/symbol-location geiser/module-location geiser/autodoc @@ -49,8 +49,8 @@ (define geiser/load-file load-file) (define geiser/compile-file compile-file) (define geiser/autodoc autodoc) - (define geiser/completions completions) - (define geiser/all-modules module-list) + (define geiser/completions symbol-completions) + (define geiser/module-completions module-completions) (define geiser/symbol-location symbol-location) (define geiser/module-location module-location) (define geiser/macroexpand macroexpand) diff --git a/scheme/plt/geiser/completions.ss b/scheme/plt/geiser/completions.ss index 013cdb1..4537feb 100644 --- a/scheme/plt/geiser/completions.ss +++ b/scheme/plt/geiser/completions.ss @@ -26,16 +26,22 @@ #lang scheme -(provide completions) +(provide symbol-completions + module-completions) -(require srfi/13 geiser/utils) +(require srfi/13 geiser/utils geiser/modules) -(define (completions prefix . context) - (let ((context (and (not (null? context)) (car context))) - (prefix? (lambda (s) (string-prefix? prefix s)))) - (append (filter prefix? (map symbol->string (local-bindings context))) - (sort (filter prefix? (map symbol->string (namespace-mapped-symbols))) - string<?)))) +(define (filter-prefix prefix lst sort?) + (filter (lambda (s) (string-prefix? prefix s)) + (if sort? (sort lst string<?) lst))) + +(define (symbol-completions prefix (context #f)) + (append (filter-prefix prefix + (map symbol->string (local-bindings context)) + #f) + (filter-prefix prefix + (map symbol->string (namespace-mapped-symbols)) + #t))) (define (local-bindings form) (define (body f) (if (> (length f) 2) (cddr f) '())) @@ -53,6 +59,7 @@ (loop (cons 'let (body form)) (cons (cadr form) bindings))) (else (loop (cdr form) bindings))))) - +(define (module-completions prefix) + (filter-prefix prefix (module-list) #f)) ;;; completions.ss ends here |