Skip to content

Incorrect highlighting if deprecation message contains ] character #515

@TwoFX

Description

@TwoFX

Prerequisites

Please put an X between the brackets as you perform the following steps:

Description

The following code produces incorrect highlighting in VS Code in recent (post-#3968) Lean releases:

@[deprecated Array.get? "Use a[i]? or a.get? i instead"]
def Array.atIndex? (a : Array α) (i : Nat) : Option α :=
  a.get? i

image

The web editor at live.lean-lang.org seems to be unaffected by this issue.

An interesting variant of this is

@[deprecated Array.get? "Use `a[i]?` or `a.get? i` instead", inherit_doc Array.get?]

where the highlighting is only broken until the end of the attribute.

Steps to Reproduce

  1. Create a new Lean project on a recent nightly and paste in the above code

Expected behavior: Highlighting should work as usual

Actual behavior: Highlighting gets confused by the ] character in the deprecation message.

Versions

4.11.0-nightly-2024-08-05
Linux markus-z16 6.9.12-200.fc40.x86_64 leanprover/lean4#1 SMP PREEMPT_DYNAMIC Sat Jul 27 15:56:15 UTC 2024 x86_64 GNU/Linux
vscode-lean4 v.0.0.176 in VS Code 1.92.0

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions