tools.completion: allow fuzzy vocab name in qualified-matching.

master
John Benediktsson 2020-09-22 11:24:04 -07:00
parent 03e62f3bc5
commit cc08ad38a4
1 changed files with 7 additions and 6 deletions

View File

@ -78,23 +78,24 @@ PRIVATE>
: name-completions ( str seq -- seq' )
[ dup name>> ] { } map>assoc completions ;
: vocabs-matching ( str -- seq )
all-disk-vocabs-recursive filter-vocabs name-completions ;
: vocab-words-matching ( str vocab -- seq )
vocab-words name-completions ;
: qualified-matching ( str -- seq/f )
":" split1 [
swap
[ vocab-words-matching ]
[ ":" append [ prepend ] curry assoc-map ] bi
swap vocabs-matching keys [
[ vocab-words ] [ vocab-name ] bi ":" append
[ over name>> append ] curry { } map>assoc
] map! concat completions
] [ drop f ] if* ;
: words-matching ( str -- seq )
[ all-words name-completions ]
[ qualified-matching [ prepend ] unless-empty ] bi ;
: vocabs-matching ( str -- seq )
all-disk-vocabs-recursive filter-vocabs name-completions ;
: chars-matching ( str -- seq )
name-map keys dup zip completions ;