FUEL: ensuring that autodoc works for qualified word references (eg unix.ffi:accept)
parent
28801e8d5f
commit
a1f9fca4dc
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2009 Jose Antonio Ortega Ruiz.
|
! Copyright (C) 2009 Jose Antonio Ortega Ruiz.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: fuel.eval io.streams.string math namespaces random.data sequences
|
USING: fuel fuel.eval io.streams.string math namespaces random.data
|
||||||
tools.test ;
|
sequences tools.test ;
|
||||||
IN: fuel.eval.tests
|
IN: fuel.eval.tests
|
||||||
|
|
||||||
! Make sure prettyprint doesn't limit output.
|
! Make sure prettyprint doesn't limit output.
|
||||||
|
@ -10,3 +10,11 @@ IN: fuel.eval.tests
|
||||||
1000 random-string fuel-eval-result set-global
|
1000 random-string fuel-eval-result set-global
|
||||||
[ fuel-send-retort ] with-string-writer length 1000 >
|
[ fuel-send-retort ] with-string-writer length 1000 >
|
||||||
] unit-test
|
] unit-test
|
||||||
|
|
||||||
|
{
|
||||||
|
"(nil \"IN: kernel PRIMITIVE: dup ( x -- x x )\" \"\")\n<~FUEL~>\n"
|
||||||
|
} [
|
||||||
|
[
|
||||||
|
V{ "\"dup\"" "fuel-word-synopsis" } "scratchpad" V{ } fuel-eval-in-context
|
||||||
|
] with-string-writer
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -117,7 +117,7 @@ PRIVATE>
|
||||||
|
|
||||||
: fuel-vocab-help ( name -- ) (fuel-vocab-help) fuel-eval-set-result ;
|
: fuel-vocab-help ( name -- ) (fuel-vocab-help) fuel-eval-set-result ;
|
||||||
|
|
||||||
: fuel-word-synopsis ( word usings -- ) (fuel-word-synopsis) fuel-eval-set-result ;
|
: fuel-word-synopsis ( word -- ) (fuel-word-synopsis) fuel-eval-set-result ;
|
||||||
|
|
||||||
: fuel-vocab-summary ( name -- )
|
: fuel-vocab-summary ( name -- )
|
||||||
(fuel-vocab-summary) fuel-eval-set-result ;
|
(fuel-vocab-summary) fuel-eval-set-result ;
|
||||||
|
|
|
@ -97,16 +97,13 @@ SYMBOL: describe-words
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: (fuel-word-help) ( name -- elem )
|
: (fuel-word-help) ( name -- elem/f )
|
||||||
fuel-find-word [
|
fuel-find-word [
|
||||||
[ auto-use? on (fuel-word-element) ] with-scope
|
[ auto-use? on (fuel-word-element) ] with-scope
|
||||||
] [ f ] if* ;
|
] [ f ] if* ;
|
||||||
|
|
||||||
: (fuel-word-synopsis) ( word usings -- str/f )
|
: (fuel-word-synopsis) ( name -- str/f )
|
||||||
[
|
fuel-find-word [ synopsis ] [ f ] if* ;
|
||||||
[ lookup-vocab ] filter interactive-vocabs [ append ] change
|
|
||||||
fuel-find-word [ synopsis ] [ f ] if*
|
|
||||||
] with-scope ;
|
|
||||||
|
|
||||||
: (fuel-word-def) ( name -- str )
|
: (fuel-word-def) ( name -- str )
|
||||||
fuel-find-word [ [ def>> pprint ] with-string-writer ] [ f ] if* ; inline
|
fuel-find-word [ [ def>> pprint ] with-string-writer ] [ f ] if* ; inline
|
||||||
|
|
|
@ -57,16 +57,16 @@ USING: form with \\[fuel-load-usings]."
|
||||||
(let ((word (or word (factor-symbol-at-point)))
|
(let ((word (or word (factor-symbol-at-point)))
|
||||||
(fuel-log--inhibit-p t))
|
(fuel-log--inhibit-p t))
|
||||||
(when word
|
(when word
|
||||||
(let* ((usings (if fuel-autodoc-eval-using-form-p :usings t))
|
(let ((cmd `(:fuel* (,word ,'fuel-word-synopsis)
|
||||||
(cmd (if (factor-on-vocab)
|
,(factor-current-vocab)
|
||||||
`(:fuel* (,word fuel-vocab-summary) :in t)
|
,(factor-usings))))
|
||||||
`(:fuel* ((,word :usings fuel-word-synopsis)) t ,usings)))
|
(let* ((ret (fuel-eval--send/wait cmd fuel-autodoc--timeout))
|
||||||
(ret (fuel-eval--send/wait cmd fuel-autodoc--timeout))
|
(res (fuel-eval--retort-result ret)))
|
||||||
(res (fuel-eval--retort-result ret)))
|
(if (not res)
|
||||||
(when (and ret (not (fuel-eval--retort-error ret)) (stringp res))
|
(message "No synposis for '%s'" word)
|
||||||
(if fuel-autodoc-minibuffer-font-lock
|
(if fuel-autodoc-minibuffer-font-lock
|
||||||
(factor-font-lock-string res)
|
(factor-font-lock-string res)
|
||||||
res))))))
|
res)))))))
|
||||||
|
|
||||||
(defvar-local fuel-autodoc--fallback-function nil)
|
(defvar-local fuel-autodoc--fallback-function nil)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue