bblanchon / SublimeText-HighlightBuildErrors

👻 A plugin for Sublime Text 3 that highlights the lines that caused errors in the build
https://sublime.wbond.net/packages/Highlight%20Build%20Errors
MIT License
12 stars 7 forks source link

More colors more types #9

Closed tolysz closed 9 years ago

tolysz commented 9 years ago

Hi, Can we have more colors with more types? Ideally user configurable ones!

somefile:302:1: warning: Unknown command "bla"
somefile:302:1: depricated: Command "bla"
somefile:302:1: error: Command "bla"
somefile:302:1: note: Command "bla"
somefile:302:1: something_to_be_captured_and_converted_into_some_color: Command "bla"
bblanchon commented 9 years ago

That would be great!

Here is an idea for the configuration:

{
  "default_color": "invalid",
  "colors": [
    {
      "regex": ".* warning:.*",
      "color": "sublimelinter.mark.error"
    },
    {
      "regex": ".* error:.*",
      "color": "sublimelinter.mark.error"
    }
  ]
}

I saw you made a fork. Do you want to implement the feature?

tolysz commented 9 years ago

Let me have a stab; it should be not very hard

tolysz commented 9 years ago

This is the closes I could do; "warning"... keys are used to distinguish regions

{
    "default_color":"invalid",
    "colors":{
    "warning":{
      "regex": ".* warning:.*",
      "color": "sublimelinter.mark.warning"
    },
    "error":{
      "regex": ".* error:.*",
      "color": "sublimelinter.mark.error"
    }
  }
}
bblanchon commented 9 years ago

Good idea. But why don't you generate the name of the region? Like build_errors_color0, build_errors_color1... I think this would be simpler for the user.

tolysz commented 9 years ago

done

bblanchon commented 9 years ago

Awesome! I'll have a look at it while I'm at home and then merge it.

bblanchon commented 9 years ago

I made a few changes.

First, there was an exception when the column was not provided by the file_regex.

Then, I changed the settings for something more intuitive:

{
  // the plugin tests each regex and stops at the first match
  "colors": [
    {
      "regex": "(warning|note)",
      "scope": "sublimelinter.mark.warning"
    },
    {
      // default color, when none of the above matches
      "scope": "sublimelinter.mark.error"
    }
  ]
}

Note that i simplified the regex and I renamed "color" into "scope" to make it clearer.

The code is pushed in branch tolysz-issue/9, please give it a try.

bblanchon commented 9 years ago

Feature available in version 1.3.0

tolysz commented 9 years ago

Thank you :)