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

HTML-ish content in docstrings causes incorrect highlighting after them #369

Open
david-christiansen opened this issue Dec 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@david-christiansen
Copy link
Contributor

Description

When a docstring contains something that could be HTML but isn't, the rest of the file is highlighted as if it were part of the docstring. This leads to incorrect fonts.

Here's a screenshot:
Screenshot 2023-12-05 at 07 40 16
Note that y and 99 are italic.

Using the "inspect scopes" feature, it seems that the doc comment is taken to extend past its bounds:
image

Context

When working with #guard_msgs from Std to test a parser, it's common to have <missing> occur in doc comments, because that's the output of a failing parser (the standard pretty-printing of Syntax.missing). After the first occurrence of it, the rest of the file is incorrectly highlighted.

I think this is because it's trying to parse the contents as Markdown, which allows arbitrary HTML to be embedded, and then that parsing extends beyond the closing -/.

This issue doesn't happen in other editors, so I'm pretty sure it's the VS Code plugin, rather than the language server sending bogus semantic tokens.

Steps to Reproduce

  1. Create a new file
  2. Insert the below text
  3. Observe the coloring
def x := 5
/--
Doc comment that mentions `missing`:
  <missing>
-/
def y := 99

Expected behavior:

def y := 99 is highlighted just like def x := 5

Actual behavior:

def y := 99 is highlighted with extra styles

Versions

[Version of vscode-lean4 (Hover over 'lean4' in the 'Extensions' menu)]
0.0.121

[Output of lean --version in the folder that the issue occured in]

Lean (version 4.4.0-nightly-2023-11-16, commit b770060b9e1a, Release)

[OS version]

Mac OS 13.6.2

Additional Information

None

Impact

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

@david-christiansen david-christiansen added the bug Something isn't working label Dec 5, 2023
@mhuisi
Copy link
Collaborator

mhuisi commented Dec 5, 2023

This looks like an oversight in our adjusted Markdown grammar.

@kbuzzard
Copy link

kbuzzard commented Feb 16, 2024

In an exciting new development, the y and 99 now seem to be no longer italic, but they're green instead :-) See Zulip thread (note: no doc comment required).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants