coq-serapi icon indicating copy to clipboard operation
coq-serapi copied to clipboard

[protocol] Add `Search` support.

Open ejgallego opened this issue 6 years ago • 4 comments

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

ejgallego avatar Apr 17 '18 01:04 ejgallego

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.

kiranandcode avatar May 10 '22 06:05 kiranandcode

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
  )

kiranandcode avatar May 10 '22 10:05 kiranandcode

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.

JasonGross avatar May 10 '22 11:05 JasonGross

@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.

ejgallego avatar May 11 '22 09:05 ejgallego