Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Syntax Highlighting Missing in Pug Language's "Buffered Comment" #24

Open
ToniWonKanobi opened this issue Mar 26, 2018 · 0 comments
Open

Comments

@ToniWonKanobi
Copy link

The Pug language has two types of comments: buffered and unbuffered.

A buffered comment is one that will get parsed to the output HTML as <!-- -->:

// I am a comment that will be parsed to output
body
  h1 This is a title
  p This is a paragraph

An unbuffered comment is one that will not get parsed to the output HTML as <!-- -->:

//- I am a comment that will *not* be parsed to output
body
  h1 This is a title
  p This is a paragraph

  1. The default "comment" key binding in Sublime Text is for an unbuffered comment

    • One Dark correctly highlights those comments:
  2. If I override that, and/or manually change every comment to be the buffered type

    • One Dark does not correctly highlight those comments:

I'm thinking that One Dark should somehow recognize that those buffered comments should be highlighted like the unbuffered ones.

I peeked at One Dark.tmTheme (not sure if this applies to Sublime Text or not), and found this bit of code:

<dict>
  <key>name</key>
  <string>Comments</string>
  <key>scope</key>
  <string>comment, punctuation.definition.comment</string>
  <key>settings</key>
  <dict>
    <key>foreground</key>
    <string>#5f697a</string>
    <key>fontStyle</key>
    <string> italic</string>
  </dict>

Maybe this could be modified somehow to recognize Pug's string.comment.buffered.block.pug, shown here:

<dict>
    <key>begin</key>
    <string>^(\s*)//</string>
    <key>comment</key>
    <string>Buffered (html) comments.</string>
    <key>end</key>
    <string>^(?!(\1\s)|\s*$)</string>
    <key>name</key>
    <string>string.comment.buffered.block.pug</string>

¯\_(ツ)_/¯

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant