coq-serapi
coq-serapi copied to clipboard
[protocol] Add `Search` support.
Right now, the code for search reads:
| Search -> [CoqString "Not Implemented"]
Names
provides a very restricted subset of Search
, however we should unify
A question is what kind of object we'd like to return from Search
, right now we just return names, but certainly a richer information would be appreciated.
cc: #51
Any update on whether this will be supported? Are there some fundamental architectural issues that are blocking this feature? If not, I don't mind taking a crack at implementing this in a separate PR - it would be particularly useful for my own projects.
I guess in the meanwhile I am able to make do with:
let evd = Evd.from_env env in
let acc = ref [] in
Search.search env evd query ([], false) (fun refr kind _ typ ->
acc := (refr,kind,typ) :: !acc
)
A question is what kind of object we'd like to return from
Search
, right now we just return names, but certainly a richer information would be appreciated.
The amount of information returned should be configurable, otherwise I expect you'll run into performance issues as company-coq does when trying to find all names available for autocompletion.
@Gopiandcode , not a lot of progress on this, as indeed current Search.search
does a linear traverse of the objects in Coq's scope, so I was hoping we could have improved the base Coq's search implementation first.
You are very welcome tho to submit a PR even with the linear scan performance issue, as @JasonGross points out, having a bit of a filter setup would alleviate that. Note that Query
already has a place in the protocol for paginating results and filters.