From: John Benediktsson Date: Sun, 19 Jun 2022 16:16:46 +0000 (-0700) Subject: tools.completion: fix logic X-Git-Tag: 0.99~1365^2 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=bf4be1ff82665424c80dc07951d893ac01f83cf8 tools.completion: fix logic --- diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index 52cac65436..80b09f8825 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -316,11 +316,11 @@ MEMO: load-index ( name -- index ) "qualified.idx" binary [ serialize ] with-file-writer ; : qualified-index ( str index -- str index' ) - over ":" split1 drop [ f ] [ + over ":" split1 [ "qualified.idx" dup file-exists? [ pick generate-qualified-index ] unless load-index completions keys concat - ] if-empty [ append ] unless-empty ; + ] [ drop f ] if [ append ] unless-empty ; : word-apropos ( string -- results ) "words.idx" load-index qualified-index completions ; diff --git a/basis/tools/completion/completion.factor b/basis/tools/completion/completion.factor index c0b87f246a..abf7dcb953 100644 --- a/basis/tools/completion/completion.factor +++ b/basis/tools/completion/completion.factor @@ -86,12 +86,12 @@ PRIVATE> vocab-words named completions ; : qualified-named ( str -- seq/f ) - ":" split1 drop [ f ] [ + ":" split1 [ vocabs-matching keys [ [ vocab-words ] [ vocab-name ] bi ":" append [ over name>> append ] curry { } map>assoc ] map concat - ] if-empty ; + ] [ drop f ] if ; : words-matching ( str -- seq ) all-words named over qualified-named [ append ] unless-empty completions ;