Inferred types: in hovers, and as inlay hints
A check keeps what the compiler inferred, through Inference.observe, as each use of a name with its type there and each binding with the type it binds. A hover shows (: name type) for a local, and a generic function's type at the use hovered. Inlay hints show the type after each local name where it is bound and no type is written. Hints before the first change since the last check are sent; the ones after it wait for the check, which then asks the client to ask again. A hover runs a check that is due first. 🤖 Generated with [ECA](https://eca.dev) Co-Authored-By: eca-agent <git@eca.dev>
This commit is contained in:
parent
cc62a8a360
commit
471b49d9e4
9 changed files with 571 additions and 20 deletions
19
Check.fs
19
Check.fs
|
|
@ -219,11 +219,21 @@ let file (buffers: Map<string, string>) (path: string) : Found list =
|
|||
Diagnostics.reset ()
|
||||
Paths.sourceOverrides <- buffers
|
||||
|
||||
// The text the check reads, for what to mark at a column and for where
|
||||
// the types it infers are.
|
||||
let text =
|
||||
match buffers.TryFind(Path.GetFullPath path) with
|
||||
| Some t -> Some t
|
||||
| None when File.Exists path -> Some(File.ReadAllText path)
|
||||
| None -> None
|
||||
|
||||
let status, printed =
|
||||
try
|
||||
Diagnostics.captured (fun () ->
|
||||
try
|
||||
Expansion.recording path (fun () -> Session.isolated (fun () -> Build.compile options path))
|
||||
Expansion.recording path (fun () ->
|
||||
Types.recording path (Option.defaultValue "" text) (fun () ->
|
||||
Session.isolated (fun () -> Build.compile options path)))
|
||||
with ex ->
|
||||
printfn "%s" (Diagnostics.humanize ex.Message)
|
||||
1)
|
||||
|
|
@ -235,13 +245,6 @@ let file (buffers: Map<string, string>) (path: string) : Found list =
|
|||
let _, report = Diagnostics.captured Timing.report
|
||||
Rpc.log report
|
||||
|
||||
// The text the check read, for what to mark at a column.
|
||||
let text =
|
||||
match buffers.TryFind(Path.GetFullPath path) with
|
||||
| Some t -> Some t
|
||||
| None when File.Exists path -> Some(File.ReadAllText path)
|
||||
| None -> None
|
||||
|
||||
let collected = Diagnostics.snapshot () |> List.map (found text path)
|
||||
|
||||
if status <> 0 && not (collected |> List.exists (fun f -> f.IsError)) then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue