asciidoctor-vscode icon indicating copy to clipboard operation
asciidoctor-vscode copied to clipboard

Syntax highlighting spills out of source block

Open cscalfani opened this issue 5 years ago • 5 comments

Description

After updating to VSCode 1.45.1 and the AsciiDoc extension 2.7.15, and Haskell Syntax Highlighting 3.2.1, syntax highlighting no longer works.

System Information

Version: 1.45.1 Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a Date: 2020-05-14T08:33:47.663Z Electron: 7.2.4 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Darwin x64 19.2.0

To Reproduce

Steps to reproduce the issue:

  1. Create a file named test.asc
  2. Add the following text:
[source,haskell]
----
data Maybe a = Nothing | Just a
----

The first word is highlighted.
  1. You should notice that the trailing ---- doesn't get interpreted as the end of the source block. Instead it's interpreted as a COMMENT in Haskell, which starts with --.

  2. You should see that the trailing ---- shows the syntax highlighting of a Haskell comment, which in my screenshot is grey.

  3. The first word of the following sentence is highlighted telling as an Uppercase Variable in Haskell.

  4. Next, add a NON-BLANK line after the data, i.e. anything AFTER the line with data in it EXCEPT for a COMMENT, i.e. a line that starts with --, and you'll see that it works properly. If the line after the line with data is a COMMENT line, it will still be broken.

  5. Next, delete the added line and change data to datax and the problem also goes away.

Seems like the word data is the problem here when there is no other non-comment line.

Screenshots & Files

image

Additional Context

Turns out that going back to an older version of the extension doesn't fix the problem.

cscalfani avatar May 20 '20 00:05 cscalfani

I found another case:

[source,haskell]
----
compareMaybe :: ∀ a. Maybe a -> Maybe a -> Boolean
----

This will spill out unless I remove the :: or add a NON-COMMENT line AFTER the line with compareMaybe.

cscalfani avatar May 20 '20 00:05 cscalfani

Turns out that downgrading to Haskell Syntax Highlighting 3.0.3 works, yet there are ZERO problems with syntax highlighting in Haskell files, just ASC files.

cscalfani avatar May 20 '20 00:05 cscalfani

Something similar as far as i can tell image

nidu avatar Jun 22 '20 08:06 nidu

Probably related to: https://github.com/asciidoctor/asciidoctor-vscode/issues/403

ggrossetie avatar May 11 '21 21:05 ggrossetie

Similar issue with TypeScript, when a type isn't followed by a ;:

Before

```ts
type Incomplete = number
```

After

Screenshot of the snippet incorrectly highlighting After

JoshuaKGoldberg avatar Dec 28 '21 19:12 JoshuaKGoldberg