deplorableword / textmate-solarized

TextMate theme for Solarized
http://ethanschoonover.com/solarized
440 stars 98 forks source link

Add distinct `Invalid` style #17

Open jasonmp85 opened 13 years ago

jasonmp85 commented 13 years ago

As it stands, the styles do a poor job of rendering any section of text marked as Invalid.

For instance, in my Git Commit Message context, the first line of the message is marked as Invalid if it's over 51 characters (weird number, I know). In most TextMate themes, as soon as the line exceeds 51 characters the entire line is highlighted in red.

In the Solarized theme, there is a style defined for the Invalid scope, but it's either identical to or indistinguishable from regular body text. I'm proposing that it be changed to use one of the reds as a background with white text as the foreground in order to signal to the user that a section of text is malformed in an important, un-ignorable way.

deplorableword commented 13 years ago

Excellent idea, have you got some git commit text I can use a reference?

jasonmp85 commented 13 years ago

Instead of a git COMMIT_EDITMSG file, here's an HTML file with a lot of invalid sections. I don't remember whether my git bundle is standard, but I can confirm the standard HTML bundle will add the invalid scope on many sections of this document in HTML mode:

<!DOC_TYPE HTML INVALID "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd>

<html>
  <head>
    <title> A terribly invalid document</title>
  </head>
  <body>
    <>Invalid Tag<>
    &invalid entity;
    <!- Invalid Comment ->

    <![INVALID_CDATA[
      Invalid line
    ]>
  </body>
</html>

If an invalid color is added to the Solarized bundle, it'll color these sections to stand out as "HEY THIS IS REALLY WRONG". I tried it locally but found the 'highlight current line' option interferes with the background color of the invalid scope if you have the caret on the invalid line, so if you can figure out how to override that then it'd be perfect.

fbzhong commented 12 years ago

That's really a great idea. I strongly suggest we implement this feature!

oesmith commented 12 years ago

This would also be totally amazing when used together with Whitespace.tmbundle in TextMate 2 -- it adds an invalid scope to trailing whitespace and mixed spaces/tabs. https://github.com/mads379/Whitespace.tmbundle

I've already added an invalid scope to my own textmate-solarized config, and it works brilliantly!