ejgallego / coq-lsp

Visual Studio Code Extension and Language Server Protocol for Coq
GNU Lesser General Public License v2.1
152 stars 31 forks source link

Type inference on hover #164

Open Alizter opened 1 year ago

Alizter commented 1 year ago

Just like OCaml LSP, we should have a way of hovering over document elements and getting back type information or in the case of ltac, perhaps some documentation.

In order to do this, we need to take the AST of the document and refine it further on query so that we can extract important information like galina terms. Afterwhich, we can pass to Check or About etc.

ejgallego commented 1 year ago

A good way to start this is to make a function point:Point.t -> Coq.Ast.t -> Coq.Id.t option

I am now wondering how does hover work when there are multiple targets on the cursor. It seems that LSP doesn't support that right? (cc : @artagnon )

ejgallego commented 1 year ago

By the way type inference and checking the type of a constant are two very different things in Coq.

ejgallego commented 1 year ago

Likely we'd like type inference to be a code action on a selection (which is very easy to implement actually, in the binder-free case)