Skip to content

fix: indent #guard_msgs code action to match command indentation#13947

Open
rdavison wants to merge 1 commit into
leanprover:masterfrom
rdavison:fix-guard-msgs-codeaction-indent
Open

fix: indent #guard_msgs code action to match command indentation#13947
rdavison wants to merge 1 commit into
leanprover:masterfrom
rdavison:fix-guard-msgs-codeaction-indent

Conversation

@rdavison

@rdavison rdavison commented Jun 3, 2026

Copy link
Copy Markdown

This PR fixes the #guard_msgs "Update with generated message" code action so that the generated doc comment respects the indentation of the #guard_msgs command. Previously the new doc comment delimiters were placed at column 0 and the #guard_msgs command lost its indentation.

For example, applying the code action to an indented invocation such as

namespace Foo
  #guard_msgs in
  #eval IO.println "a\nb"
end Foo

previously produced (note the column-0 -/ and the de-indented #guard_msgs):

namespace Foo
  /--
info: a
b
-/
#guard_msgs in
  #eval IO.println "a\nb"
end Foo

and now produces:

namespace Foo
  /--
info: a
b
  -/
  #guard_msgs in
  #eval IO.println "a\nb"
end Foo

The replaced range runs from the doc comment up to the #guard_msgs token, which includes the command's leading whitespace, so the generated text now reuses that indentation for the closing -/ delimiter and to re-indent the command. The message body stays flush-left because it is compared verbatim (modulo the whitespace mode), matching the existing convention in tests/elab/mutual_coinduction.lean.

🤖 Generated with Claude Code

This PR fixes the `#guard_msgs` "Update with generated message" code action so that the generated doc comment respects the indentation of the `#guard_msgs` command. Previously the new doc comment delimiters were placed at column 0 and the `#guard_msgs` command lost its indentation.

The replaced range runs from the doc comment up to the `#guard_msgs` token, which includes the command's leading whitespace, so the generated text now reuses that indentation for the closing `-/` delimiter and to re-indent the command. The message body stays flush-left because it is compared verbatim (modulo the whitespace mode).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@rdavison rdavison requested a review from digama0 as a code owner June 3, 2026 19:12
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jun 3, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 9820f61873fc94ae9fc94b8e23a02336a8741f09 --onto c47a0c7cf035381a2bcdd4cdf2442782eb4a5214. You can force Mathlib CI using the force-mathlib-ci label. (2026-06-03 20:03:10)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 9820f61873fc94ae9fc94b8e23a02336a8741f09 --onto 803553a556fd82fa1060efb0c43eda542130cb16. You can force reference manual CI using the force-manual-ci label. (2026-06-03 20:03:12)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants