sveltejs / sveltejs/language-tools

Pug syntax highlighting breaks when attributes have curly braces

Open
#751 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.4k
Forks
252
Avg merge
8d 13h
Merged PRs (30d)
2

Description

Describe the bug
As you can see in the screenshot below, Pug syntax highlighting breaks when attributes have JS values using curly brace syntax. Specifically, when an attribute has curly brace syntax, syntax highlighting breaks for the attributes that come directly after, if they too have curly brace syntax.

image

To reproduce
Create a .svelte file with the following:

<template lang="pug">
  p Hello world
  Example(one="{24}" two="{2}")
  Example(one="{24}" two="{2}" three='dd' four='{3}' five='{3}')
  Example(one="x{24}" two="{2}")
  Example(one="24" two="2")
</template>

To make sure this wasn't due to some other extension interfering, I opened a clean instance of VSCode by running code . --user-data-dir ./vscodewhatever --extensions-dir ./vscodewhateverext.

Expected behavior
The expected behavior would be for all attributes to have consistent colors.

System

  • OS: macOS 10.14.6
  • IDE: VSCode 1.52.1
  • Plugin/Package: Svelte for VSCode 103.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in a .svelte file using the supplied Pug examples, especially adjacent attributes with curly-brace values. Trace the Svelte/Pug syntax-highlighting handling for those attributes; the work is done when all reproduced attributes receive consistent highlighting in VSCode.

Written by the indexing model from the issue text.

Assessment

Tech stack
pug, typescript, vscode
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.