Hook into VsRocq extension's API #26

Merged
marfavi merged 22 commits from vsrocq-api into main 2026-10-14 15:09:39 +02:00
Owner
No description provided.
Add integration tests for Create Rocq Model and dependencies
All checks were successful
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m27s
Grammar / Corpus and binding tests (pull_request) Successful in 41s
884f1100c7
- Cover the command end-to-end via shell integration
- Test the files, logging and terminal dependencies
- Re-create the log output channel after deactivate
Merge remote-tracking branch 'origin/main' into vsrocq-api
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 46s
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m43s
0d22cb6f8c
remove obsolete vsrocq fixture
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 45s
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m43s
f4ee4a6acc
marfavi changed title from vsrocq-api to Hook into VsRocq extension's API to check proof status 2026-10-14 12:23:27 +02:00
marfavi changed title from Hook into VsRocq extension's API to check proof status to Hook into VsRocq extension's API 2026-10-14 12:23:47 +02:00
ci: run both workflows in prebuilt images
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 54s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m19s
1b73d99bc8
Bake the toolchains into images built from the sibling forgejo-runner
repo (crocq-ci-extension, crocq-ci-grammar) and drop the per-run
"Install native build toolchain" apt steps. The extension image also
carries clightgen (CompCert 3.17) and a pinned VsRocq .vsix for the
end-to-end tests.
Merge branch 'main' into ci/custom-images
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 37s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m21s
3987d70b5b
Merge branch 'ci/custom-images' into vsrocq-api
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 39s
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m28s
99062182ed
EatOreo changed title from Hook into VsRocq extension's API to WIP: Hook into VsRocq extension's API 2026-10-14 12:28:48 +02:00
marfavi force-pushed vsrocq-api from 99062182ed
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 39s
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m28s
to f4ee4a6acc
Some checks failed
Grammar / Corpus and binding tests (pull_request) Successful in 45s
Extension / Format, types, lint, extension tests (pull_request) Failing after 1m43s
2026-10-14 12:29:18 +02:00
Compare
ci: run both workflows in prebuilt images
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 54s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m19s
1b73d99bc8
Bake the toolchains into images built from the sibling forgejo-runner
repo (crocq-ci-extension, crocq-ci-grammar) and drop the per-run
"Install native build toolchain" apt steps. The extension image also
carries clightgen (CompCert 3.17) and a pinned VsRocq .vsix for the
end-to-end tests.
Merge branch 'main' into ci/custom-images
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 37s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m21s
3987d70b5b
test: install the baked VsRocq vsix in the CI image
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 41s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m33s
ac84d5162e
The CI image ships a pinned VsRocq .vsix and exports CROCQ_VSROCQ_VSIX,
so use it when present instead of reaching the marketplace.
marfavi self-assigned this 2026-10-14 13:31:25 +02:00
marfavi changed title from WIP: Hook into VsRocq extension's API to Hook into VsRocq extension's API 2026-10-14 13:34:25 +02:00
Merge branch 'main' into vsrocq-api
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 42s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m38s
c069f02d8e
marfavi requested changes 2026-10-14 14:08:19 +02:00
Dismissed
@ -14,3 +14,4 @@
proofClause: RocqDefinitionLink | null;
}
export interface RocqDefinitionLink {
Owner

You removed "definition" from the definitionName field below, so also do it here.

You removed "definition" from the `definitionName` field below, so also do it here.
EatOreo marked this conversation as resolved
@ -20,3 +21,4 @@
targetName: string;
}
export interface LoopAnnotation {
Owner

(Perhaps off topic) Does it make sense to have LoopAnnotation and FunctionAnnotation inherit the same superclass Annotation, since we want to match on kind❓

And rearrange interfaces such that LoopAnnotation and FunctionAnnotation are next to each other in code

(Perhaps off topic) Does it make sense to have `LoopAnnotation` and `FunctionAnnotation` inherit the same superclass `Annotation`, since we want to match on `kind`❓ And rearrange interfaces such that `LoopAnnotation` and `FunctionAnnotation` are next to each other in code
EatOreo marked this conversation as resolved
@ -46,3 +60,3 @@
clause: Node,
existing: ClauseNode | null,
keyword: 'PRE' | 'POST',
clauseName: 'PRE' | 'POST',
Owner

clauseName (defined here) vs kind (defined in interface RocqDefinitionLink above) - enforce one style?

`clauseName` (defined here) vs `kind` (defined in `interface RocqDefinitionLink` above) - enforce one style?
EatOreo marked this conversation as resolved
@ -59,2 +75,4 @@
async function parseLinkClause(
clause: Node,
existing: RocqDefinitionLink | null,
clauseName: 'SPEC' | 'PROOF',
Owner

clauseName (defined here) vs kind (defined in interface RocqDefinitionLink above) - enforce one style?

`clauseName` (defined here) vs `kind` (defined in `interface RocqDefinitionLink` above) - enforce one style?
EatOreo marked this conversation as resolved
@ -155,3 +187,3 @@
}
});
}
const [firstInvClause] = invClauses;
Owner

safer to use .head/.first or similar?

safer to use .head/.first or similar?
EatOreo marked this conversation as resolved
@ -0,0 +16,4 @@
?.activate();
}
// proofDocumentUri:proofName
Owner

Add better documentation & use doc comment

Add better documentation & use doc comment
Owner

I'd prefer named parameters here (use a dictionary). Otherwise you pass a bare number with no explanation when calling this function.

I'd prefer named parameters here (use a dictionary). Otherwise you pass a bare number with no explanation when calling this function.
EatOreo marked this conversation as resolved
@ -0,0 +21,4 @@
vsRocqApi: VsRocqApi,
proofDocumentUri: vscode.Uri,
proofName: string,
retries = 0,
Owner

I thought it meant "what number retry are you on"❓ Make less ambigious by renaming to maxRetries or similar.

I thought it meant "what number retry are you on"❓ Make less ambigious by renaming to `maxRetries` or similar.
EatOreo marked this conversation as resolved
@ -0,0 +37,4 @@
if (!proofs) {
return null;
}
const escapedProofName = proofName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
Owner

trims out Theorem, Lemma from the proof name - document this, and perhaps rename the constant

trims out `Theorem`, `Lemma` from the proof name - document this, and perhaps rename the constant
Owner

Also why this regex in particular❓ Document the reason, or change the regex if it is overkill

Also why this regex in particular❓ Document the reason, or change the regex if it is overkill
EatOreo marked this conversation as resolved
@ -0,0 +24,4 @@
retries = 0,
): Promise<ProofBlock | null> {
let proofs: DocumentProofsResponse | undefined;
for (let attempt = 0; attempt < 1 + retries; attempt++) {
Owner

Add comment explaining why this loop is needed

Add comment explaining why this loop is needed
EatOreo marked this conversation as resolved
@ -0,0 +30,4 @@
break;
} catch {
if (attempt < retries) {
await new Promise((resolve) => setTimeout(resolve, 100));
Owner

// Sleep for 100 ms before next retry

`// Sleep for 100 ms before next retry`
EatOreo marked this conversation as resolved
@ -0,0 +48,4 @@
return proof ?? null;
}
// proofDocumentUri:definitionName
Owner

Add better documentation & use doc comment

Add better documentation & use doc comment
EatOreo marked this conversation as resolved
@ -0,0 +88,4 @@
return null;
}
function removeComments(
Owner

Why is it needed❓ Document the reason

Why is it needed❓ Document the reason
EatOreo marked this conversation as resolved
@ -0,0 +1,178 @@
// copied from https://github.com/rocq-prover/vsrocq/blob/main/client/src/protocol/types.ts
Owner

Mark file as vendored or external (use .gitattributes file to do this)

Mark file as vendored or external (use .gitattributes file to do this)
EatOreo marked this conversation as resolved
@ -85,1 +85,4 @@
const vsRocqApi = await getVsRocqApi();
if (vsRocqApi === undefined) {
vscode.window.showErrorMessage('failed to load vsrocq extension!');
Owner

Remove, or hide from production (use debug logging or similar).

Dependency manager already checks for the presence of VsRocq.

Remove, or hide from production (use debug logging or similar). Dependency manager already checks for the presence of VsRocq.
EatOreo marked this conversation as resolved
@ -86,0 +87,4 @@
if (vsRocqApi === undefined) {
vscode.window.showErrorMessage('failed to load vsrocq extension!');
} else {
vscode.window.showInformationMessage('loaded vsrocq extension');
Owner

Remove, or hide from production (use debug logging or similar).

Dependency manager already checks for the presence of VsRocq.

Remove, or hide from production (use debug logging or similar). Dependency manager already checks for the presence of VsRocq.
EatOreo marked this conversation as resolved
@ -86,0 +88,4 @@
vscode.window.showErrorMessage('failed to load vsrocq extension!');
} else {
vscode.window.showInformationMessage('loaded vsrocq extension');
// vsRocqApi.onProofStateChanged((p) => {
Owner

Remove dead code.

Remove dead code.
EatOreo marked this conversation as resolved
@ -123,2 +136,4 @@
),
);
// TODO: code completions suggesting proofs/definitions to link to when writing a PROOF or SPEC clause
Owner

Remove comment as it doesn't point to specific code & the issue is already present in the issue tracker.

Remove comment as it doesn't point to specific code & the issue is already present in the issue tracker.
EatOreo marked this conversation as resolved
@ -14,1 +23,4 @@
): (doc: vscode.TextDocument) => Promise<void> {
return async (doc) => {
if (doc.languageId === 'c') {
if (!vsRocqApi) {
Owner

Slightly off-topic: Find a way to make vsRocqApi non-nullable in this scope.

Slightly off-topic: Find a way to make `vsRocqApi` non-nullable in this scope.
EatOreo marked this conversation as resolved
@ -14,1 +25,4 @@
if (doc.languageId === 'c') {
if (!vsRocqApi) {
vscode.window.showErrorMessage(
'failing to connect to VsRocq extension!!',
Owner

Remove, or hide from production (use debug logging or similar).

Dependency manager already checks for the presence of VsRocq.

Remove, or hide from production (use debug logging or similar). Dependency manager already checks for the presence of VsRocq.
EatOreo marked this conversation as resolved
@ -28,0 +87,4 @@
}
}
} catch {
diagnostics.push(
Owner

Is this the only kind of error we can catch from the code above?

Is this the only kind of error we can catch from the code above?
EatOreo marked this conversation as resolved
@ -28,0 +58,4 @@
vsRocqApi,
fileUri,
linkClause.targetName,
3, // these are retries if the vsRocqApi might not be initialized should NOT be as many in onChangeDocument
Owner

Line width is too long.

Line width is too long.
EatOreo marked this conversation as resolved
@ -28,0 +85,4 @@
);
break;
}
}
Owner

In general this file's indentation is too deep. We could attempt to flatten it out a bit more.

In general this file's indentation is too deep. We could attempt to flatten it out a bit more.
EatOreo marked this conversation as resolved
@ -198,11 +198,6 @@ suite('commands/createRocqModel (integration)', () => {
);
if (execution === undefined) {
// A host advertised shell integration via
Owner

Is this comment still relevant❓ If so, we should restore it.

Is this comment still relevant❓ If so, we should restore it.
EatOreo marked this conversation as resolved
@ -0,0 +1,384 @@
From Coq Require Import String List ZArith.
Owner

Should we have a comment at the top of the file explaining the justification of this file?

Should we have a comment at the top of the file explaining the justification of this file?
EatOreo marked this conversation as resolved
@ -0,0 +29,4 @@
);
await vscode.window.showTextDocument(document);
assert.ok(vsRocqApi);
await delay(1_000); // letting vsrocq load the rocq document
Owner

Magic number that always delays this test by the same amount regardless of speed. Is it possible to use waitFor or another test utility?

Magic number that always delays this test by the same amount regardless of speed. Is it possible to use waitFor or another test utility?
EatOreo marked this conversation as resolved
@ -0,0 +33,4 @@
return document;
}
test('vsrocq interpret to end', async () => {
Owner

'VsRocq interpretToEnd notifies onProofStateChanged event listener'

'VsRocq interpretToEnd notifies onProofStateChanged event listener'
EatOreo marked this conversation as resolved
@ -0,0 +43,4 @@
});
test('vsrocqApi get proof block', async () => {
const document = await openAndShowTestRocqDoc('verif_sumarray.v');
Owner

Test uses a lot of sensitive magic numbers for code position.

This could be fine if verif_sumarray.v had a notice comment at the top which mentions that editing the file could break this test.

Test uses a lot of sensitive magic numbers for code position. This could be fine if `verif_sumarray.v` had a notice comment at the top which mentions that editing the file could break this test.
EatOreo marked this conversation as resolved
@ -0,0 +74,4 @@
});
test('gets blocks for minimal completed proofs', async () => {
const document = await openAndShowTestRocqDoc('simple_proofs.v');
Owner

Test uses sensitive magic numbers for code position.

This could be fine if simple_proofs.v had a notice comment at the top which mentions that editing the file could break this test.

Test uses sensitive magic numbers for code position. This could be fine if `simple_proofs.v` had a notice comment at the top which mentions that editing the file could break this test.
EatOreo marked this conversation as resolved
@ -0,0 +94,4 @@
});
test('handles exact proof names and non-proofs', async () => {
const document = await openAndShowTestRocqDoc('edge_case_proofs.v');
Owner

Test uses a lot of sensitive magic numbers for code position.

This could be fine if edge_case_proofs.v had a notice comment at the top which mentions that editing the file could break this test.

Test uses a lot of sensitive magic numbers for code position. This could be fine if `edge_case_proofs.v` had a notice comment at the top which mentions that editing the file could break this test.
EatOreo marked this conversation as resolved
@ -0,0 +134,4 @@
});
test('returns blocks for admitted and incomplete proofs', async () => {
const document = await openAndShowTestRocqDoc('broken_proofs.v');
Owner

Test uses a lot of sensitive magic numbers for code position.

This could be fine if broken_proofs.v had a notice comment at the top which mentions that editing the file could break this test.

Test uses a lot of sensitive magic numbers for code position. This could be fine if `broken_proofs.v` had a notice comment at the top which mentions that editing the file could break this test.
EatOreo marked this conversation as resolved
@ -0,0 +158,4 @@
});
test('gets ranges for single-line and multiline definitions', async () => {
const document = await openAndShowTestRocqDoc('definitions.v');
Owner

Test uses a lot of sensitive magic numbers for code position.

This could be fine if definitions.v had a notice comment at the top which mentions that editing the file could break this test.

Test uses a lot of sensitive magic numbers for code position. This could be fine if `definitions.v` had a notice comment at the top which mentions that editing the file could break this test.
EatOreo marked this conversation as resolved
@ -0,0 +193,4 @@
});
test('matches definition names exactly and ignores comments', async () => {
const document = await openAndShowTestRocqDoc('definitions.v');
Owner

Test uses a lot of sensitive magic numbers for code position.

This could be fine if definitions.v had a notice comment at the top which mentions that editing the file could break this test.

Test uses a lot of sensitive magic numbers for code position. This could be fine if `definitions.v` had a notice comment at the top which mentions that editing the file could break this test.
EatOreo marked this conversation as resolved
@ -0,0 +221,4 @@
});
test('gets definition ranges from verif_sumarray.v', async () => {
const document = await openAndShowTestRocqDoc('verif_sumarray.v');
Owner

Test uses a lot of sensitive magic numbers for code position.

This could be fine if verif_sumarray.v had a notice comment at the top which mentions that editing the file could break this test.

Test uses a lot of sensitive magic numbers for code position. This could be fine if `verif_sumarray.v` had a notice comment at the top which mentions that editing the file could break this test.
EatOreo marked this conversation as resolved
omid changes
Some checks are pending
Extension / Format, types, lint, extension tests (pull_request) Waiting to run
Grammar / Corpus and binding tests (pull_request) Waiting to run
76e03d38e6
EatOreo scheduled this pull request to auto merge when all checks succeed 2026-10-14 15:02:51 +02:00
Merge branch 'main' into vsrocq-api
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 42s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m35s
6d2e4f9c70
marfavi approved these changes 2026-10-14 15:08:22 +02:00
marfavi left a comment

This is epic

This is epic
marfavi deleted branch vsrocq-api 2026-10-14 15:09:42 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
code2rocq/crocq!26
No description provided.