Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get proof blocks api #960

Merged
merged 10 commits into from
Dec 11, 2024
Merged

Get proof blocks api #960

merged 10 commits into from
Dec 11, 2024

Conversation

rtetley
Copy link
Collaborator

@rtetley rtetley commented Dec 6, 2024

This PR aims at exposing an API which will allow extensions to query the document and get proof blocks in a structured view. This can be useful for a number of users who which to build an extension to vscoq.

Down the line we also ended up fixing an outline bug, in which symbols were never removed but always added.

This will allow to create an api so that outside extensions can query the document
and get a structured view of the proofs it contains.
Now extensions that depend on vscoq can get all the document proofs.
@rtetley rtetley force-pushed the get-proof-blocks-api branch from 431d806 to 0b05cfb Compare December 9, 2024 10:28
@rtetley rtetley marked this pull request as ready for review December 9, 2024 10:28
@@ -284,6 +301,9 @@ module Request = struct
| "vscoq/documentState" ->
let+ params = Lsp.Import.Json.message_params params DocumentStateParams.t_of_yojson in
Pack (DocumentState params)
| "vscoq/documentProofs" ->
let+ params = Lsp.Import.Json.message_params params DocumentProofsParams.t_of_yojson in
Pack (DocumentProofs params)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if we can easily version these custom queries, eg "vscoq/documentProofs/v1" so that we can update the format later without necessarily breaking badly the plugins that use this extension

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So after thinking about it, we make it accessible through a function in the client. If we need new versions it should be easy to keep everything wired on our end when plugins use our extension.

const params: DocumentProofsRequest = {textDocument};
const req = new RequestType<DocumentProofsRequest, DocumentProofsResponse, void>("vscoq/documentProofs");
Client.writeToVscoq2Channel("Getting proofs for: " + uri.toString());
client.sendRequest(req, params).then(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This promise should probably be returned

@rtetley rtetley force-pushed the get-proof-blocks-api branch from 8a582b4 to a3b30ba Compare December 10, 2024 12:50
Before we would only add new sentences during the parsing phase, which works
on the first parsing but leads to unwanted behaviors after an edit.
If the document is parsing, the document should resend the
documentProofs request later.
@rtetley rtetley merged commit c33919f into main Dec 11, 2024
27 of 28 checks passed
@rtetley rtetley deleted the get-proof-blocks-api branch December 13, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants