vscode-textmate: [jade] Incorrect highlighting in strings with inline tags

From @mrmlnc on January 4, 2016 12:54

VS Code version: 0.10.6

Code:

p #[code samp] — Regular text. #[samp This is sample text] more text.

Description: If you try to write a dot in a inline tag (tag Interpolation), text highlighting changes.

Gif: 2016-01-04_15-44-32

Copied from original issue: Microsoft/vscode#1765

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16 (11 by maintainers)

Commits related to this issue

Most upvoted comments

This is an old issue, but PR #86 would fix this. The error occurs at:

@@scanNext: | Two text.\n|
  scanning for
   - -1: (\])
   - 63: (?<!\\)(#\[)
   - 35: ((?:mixin\s+)|\+)([\w-]+)
   - 68: (?<!\])(?=[\w.#])|(:\s*)
   - 33: (-|(([a-zA-Z0-9_]+)\s+=))
   - 59: (!?\=)\s*
   - 70: \[
   - 72: \[
   - 63: (?<!\\)(#\[)
   - 73: (?=<[^>]*>)
   - 75: (&)([a-zA-Z0-9]+|#[0-9]+|#x[0-9a-fA-F]+)(;)
   - 76: [<>&]
   - 21: (?<!\\)[#!]\{(?=.*?\})
   - 23: (?<!\\)[#!]\{(?=[^}]*$)
  token: | |
      * text.jade
      * inline.jade
  pushing BeginEndRule#68 @ Jade.json:556 - (?<!\])(?=[\w.#])|(:\s*)

See how items 70 and 72 are the same? That is happening because a rule is getting skipped because its begin value is “” (empty), Item 72 is the first of its inner patterns, but because its blank begin rule is ignored, the other rules are not pushed away, and so the tag rule just keeps consuming the text (matching rule 68), until the end rule for the closing bracket is met.

The detail of two identical rules is what tipped me to look at the grammar closer, to catch the empty begin.

Hello, @alexandrudima and @aeschli,

I think we can close this issue? I tried to work with TextMate2 and there’s this grammar is working properly.

2016-11-09_13-18-03

I see that you started updating some grammar (https://github.com/Microsoft/vscode/commit/f1672e4de75b09f15e456ec126dc669c25ba5043, https://github.com/Microsoft/vscode/commit/fbdf234775f9af8a9f99f4af571364676b1d9770 and etc.).

Well, I think I’ll be contribute to one of the implementations of Jade grammar and try to solve all my problems. Later I’ll create the issue in VS Code repository with request to update Jade grammar.