mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-11 06:05:12 +03:00
Show aliases when searching by type
This commit is contained in:
parent
7b98c3455c
commit
09afe1e1f0
@ -1567,8 +1567,14 @@ _searchBranchPrefix b n = case Path.unsnoc (Path.fromName n) of
|
||||
|
||||
searchResultsFor :: Names0 -> [Referent] -> [Reference] -> [SearchResult]
|
||||
searchResultsFor ns terms types =
|
||||
[ SR.termSearchResult ns (Names.termName ns ref) ref | ref <- terms ] <>
|
||||
[ SR.typeSearchResult ns (Names.typeName ns ref) ref | ref <- types ]
|
||||
[ SR.termSearchResult ns name ref
|
||||
| ref <- terms
|
||||
, name <- toList (Names.namesForReferent ns ref)
|
||||
] <>
|
||||
[ SR.typeSearchResult ns name ref
|
||||
| ref <- types
|
||||
, name <- toList (Names.namesForReference ns ref)
|
||||
]
|
||||
|
||||
searchBranchScored :: forall score. (Ord score)
|
||||
=> Names0
|
||||
|
@ -27,8 +27,6 @@ module Unison.Names2
|
||||
, prefix0
|
||||
, restrictReferences
|
||||
, refTermsNamed
|
||||
, termName
|
||||
, typeName
|
||||
, terms
|
||||
, types
|
||||
, termReferences
|
||||
@ -39,6 +37,7 @@ module Unison.Names2
|
||||
, unionLeft
|
||||
, unionLeftName
|
||||
, namesForReference
|
||||
, namesForReferent
|
||||
)
|
||||
where
|
||||
|
||||
@ -175,20 +174,6 @@ numHashChars b = lenFor hashes
|
||||
g s r = Set.insert r s
|
||||
f s r = Set.insert (Referent.toReference r) s
|
||||
|
||||
typeName :: Ord n => Names' n -> Reference -> n
|
||||
typeName names r =
|
||||
case toList $ R.lookupRan r (types names) of
|
||||
hq : _ -> hq
|
||||
_ -> error
|
||||
("Names construction should have included something for " <> show r)
|
||||
|
||||
termName :: Ord n => Names' n -> Referent -> n
|
||||
termName names r =
|
||||
case toList $ R.lookupRan r (terms names) of
|
||||
hq : _ -> hq
|
||||
_ -> error
|
||||
("Names construction should have included something for " <> show r)
|
||||
|
||||
termsNamed :: Ord n => Names' n -> n -> Set Referent
|
||||
termsNamed = flip R.lookupDom . terms
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user