Add a command to format Crocq annotations & format on save option #88

Merged
marfavi merged 9 commits from feat/format-annotations into main 2026-10-29 14:59:29 +01:00
Owner

Fixes #78

Crocq: Format annotations re-indents annotation blocks and inline bodies in the active C file.

We need to not override the user's default C formatter, which is why we have our own format command (can't have two formatters for a file run in sequence).

Format on save option added, which is true by default.

Fixes #78 `Crocq: Format annotations` re-indents annotation blocks and inline bodies in the active C file. We need to not override the user's default C formatter, which is why we have our own format command (can't have two formatters for a file run in sequence). Format on save option added, which is true by default.
Add a command to format Crocq annotations (#78)
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 59s
Extension / Format, types, lint, extension tests (pull_request) Successful in 2m56s
10036d378c
marfavi changed title from Add a command to format Crocq annotations to WIP: Add a command to format Crocq annotations 2026-10-29 09:54:40 +01:00
Add format on save option
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 45s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m39s
ebbf75911e
marfavi changed title from WIP: Add a command to format Crocq annotations to Add a command to format Crocq annotations 2026-10-29 10:16:50 +01:00
michael requested changes 2026-10-29 13:05:47 +01:00
Dismissed
@ -56,0 +60,4 @@
},
"crocq.formatAnnotationsOnSave": {
"type": "boolean",
"default": true,
Owner

default should be either false by default or be the same as vscode formatOnSave

default should be either false by default or be the same as vscode formatOnSave
marfavi marked this conversation as resolved
@ -0,0 +21,4 @@
]);
/** Removes the indentation shared by every line. */
function dedent(text: string): string {
Owner

This is the exact same method as this comment is made on: #84/files (comment)
just made in a different location (the issue mentioned in that comment also applies here)

This is the exact same method as this comment is made on: https://git.marfavi.com/code2rocq/crocq/pulls/84/files#issuecomment-1522 just made in a different location (the issue mentioned in that comment also applies here)
marfavi marked this conversation as resolved
# Conflicts:
#	extension/src/extension.ts
Address format annotations review feedback
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 48s
Extension / Format, types, lint, extension tests (pull_request) Successful in 2m23s
90f3b6271c
Make crocq.formatAnnotationsOnSave a three-way choice: follow (the default, format explicit saves only), yes (also format auto-saves) and no (never format on save). Boolean values from the earlier revision are still understood.

Reuse the dedent implementation from inlineClauseBody in the annotation formatter instead of duplicating it, and cover the shared behaviour with an inline-body indentation test.
Format all C files in example/
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 43s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m56s
1d52eb61d5
marfavi changed title from Add a command to format Crocq annotations to Add a command to format Crocq annotations & format on save option 2026-10-29 14:49:39 +01:00
marfavi scheduled this pull request to auto merge when all checks succeed 2026-10-29 14:50:42 +01:00
add auto formatted V file
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 47s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m58s
677090714a
michael requested changes 2026-10-29 14:55:14 +01:00
Dismissed
@ -0,0 +1 @@
Subproject commit db65bd0d58e008e1cd81c1d70c6f83e5d0ab6398
Owner

...

...
Remove accidentally added vsrocq submodule
All checks were successful
Grammar / Corpus and binding tests (pull_request) Successful in 43s
Extension / Format, types, lint, extension tests (pull_request) Successful in 1m59s
6c2e7c3a0f
The local VsRocq checkout was picked up by `git add -A` in 1d52eb6 and
recorded as a gitlink with no .gitmodules entry. Stop tracking it and ignore
the directory so it cannot be re-added by accident.
michael approved these changes 2026-10-29 14:58:23 +01:00
marfavi scheduled this pull request to auto merge when all checks succeed 2026-10-29 14:58:36 +01:00
marfavi deleted branch feat/format-annotations 2026-10-29 14:59:29 +01: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!88
No description provided.