Repository navigation
feat: add range parameter to getInteractiveDiagnostics - #722
Conversation
| structure LineRange where | ||
| start : Nat | ||
| «end» : Nat | ||
| deriving Inhabited, Repr, RpcEncoding |
There was a problem hiding this comment.
These two types should be in Lsp/Extra.lean. It should also suffice to derive From/ToJson instead of RpcEncoding as this contains no RPC refs.
There was a problem hiding this comment.
Moved. I didn't want to put it there at first because it's not an LSP type (and other types used in RPC are not defined there either).
There was a problem hiding this comment.
Ah right, that's because of dependency issues with types that derive RpcEncoding (which Extra.lean can't import iirc). But every type that we can, we should put in Extra.lean whose point is to collate all our additions to LSP. So I would put the GetInteractiveDiagnosticsParams there as well (and also only derive From/ToJson for it, RpcEncoding has an umbrella instance for JSON-encodable types).
There was a problem hiding this comment.
Ah wait no, I forgot RPC calls are all one LSP request 🤦 Okay, let's leave the Params here for now. I will add a file similar to Lsp/Extra.lean describing all RPC requests later.
mathlib3 SHA: 6b3325cdf0b4b23496391a451324c95a1dc36d9e porting notes: * overall, very straightforward * I made `GroupWithZero` extend `Nontrivial` to match mathlib3, and we didn't have this instance previously because it didn't extend that class. Co-authored-by: Scott Morrison <[email protected]>
Currently,
getInteractiveDiagnosticsblocks until the whole file is processed. This means that the infoview hangs and doesn't show diagnostics. See e.g. Julian/lean.nvim#162This PR adds a range parameter to the
getInteractiveDiagnosticsRPC call:If
lineRangeis present, the server will only wait until the document has finished processing up to the end position. Furthermore only diagnostics whosefullRangeintersects the range parameter are returned. This also solves another potential performance issue by significantly reducing the amount of diagnostics that are sent.Tested using Julian/lean.nvim#169