Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added the basics of colored output.

I added a language to parse the output into entities and then a theme
file to associate colors with those entities. I then applied the
language and the them to the view programatically in the plugin.
  • Loading branch information...
commit 70ddbccf228e7e8166652102366aed00bb71c136 1 parent 76fef52
@cyphactor authored
View
4 .gitignore
@@ -1 +1,3 @@
-*.pyc
+*.pyc
+*.tmTheme.cache
+*.tmLanguage.cache
View
133 GuardOutput.tmLanguage
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>name</key>
+ <string>GuardOutput</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>include</key>
+ <string>#failed_examples</string>
+ </dict>
+ <dict>
+ <key>include</key>
+ <string>#comments</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>test pass</string>
+ <key>match</key>
+ <string>(^|\s)\d+ (tests|assertions|examples?|passed)</string>
+ <key>name</key>
+ <string>test.pass</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>test error</string>
+ <key>match</key>
+ <string>(\d+ errors)|(\d+\) Error:|Failing \w*:|cucumber(\s\S*)|\d failed)</string>
+ <key>name</key>
+ <string>test.error</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>test fail</string>
+ <key>match</key>
+ <string>(\d+ failures?)|(\d+\) Failure:)|\d+ undefined</string>
+ <key>name</key>
+ <string>test.fail</string>
+ </dict>
+ <dict>
+ <key>comment</key>
+ <string>test cucumber</string>
+ <key>match</key>
+ <string>Feature|Scenario|Given|And|When|Then|\d+ skipped</string>
+ <key>name</key>
+ <string>test.cucumber</string>
+ </dict>
+ <dict>
+ <key>begin</key>
+ <string>Running tests(\s+with\s+args\s+\[.*\]\.*\n)?</string>
+ <key>comment</key>
+ <string>dots painting</string>
+ <key>end</key>
+ <string>Finished|Failures</string>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>match</key>
+ <string>\.+|passed</string>
+ <key>name</key>
+ <string>test.pass.rspec_output</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>E+</string>
+ <key>name</key>
+ <string>test.error.rspec_output</string>
+ </dict>
+ <dict>
+ <key>match</key>
+ <string>F+</string>
+ <key>name</key>
+ <string>test.fail.rspec_output</string>
+ </dict>
+ </array>
+ </dict>
+ <dict>
+ <key>begin</key>
+ <string>\s+\d+\)\s+[\w+:#\s]+</string>
+ <key>comment</key>
+ <string>failure tracebacks</string>
+ <key>contentName</key>
+ <string>test.fail</string>
+ <key>end</key>
+ <string>[.#]*(#\s+[.\w\/:#\s`\(\)&lt;&gt;]+')</string>
+ <key>endCaptures</key>
+ <dict>
+ <key>0</key>
+ <dict>
+ <key>name</key>
+ <string>test.comment.rspec_output</string>
+ </dict>
+ </dict>
+ </dict>
+ </array>
+ <key>repository</key>
+ <dict>
+ <key>comments</key>
+ <dict>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>comment</key>
+ <string>comment</string>
+ <key>match</key>
+ <string>[.#]*#\s+[.\w\/:#\s`\(\)&lt;&gt;]+</string>
+ <key>name</key>
+ <string>test.comment.rspec_output</string>
+ </dict>
+ </array>
+ </dict>
+ <key>failed_examples</key>
+ <dict>
+ <key>patterns</key>
+ <array>
+ <dict>
+ <key>comment</key>
+ <string>test reference</string>
+ <key>match</key>
+ <string>^rspec\s+[.\/\w]+:\d+\b</string>
+ <key>name</key>
+ <string>test.reference.rspec_output</string>
+ </dict>
+ </array>
+ </dict>
+ </dict>
+ <key>scopeName</key>
+ <string>rspec_output.test</string>
+ <key>uuid</key>
+ <string>72174d10-bb12-11e0-962b-112233445566</string>
+</dict>
+</plist>
View
76 GuardOutput.tmTheme
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>comment</key>
+ <string>Guard Output Theme</string>
+ <key>name</key>
+ <string>GuardOutput</string>
+ <key>settings</key>
+ <array>
+ <dict>
+ <key>settings</key>
+ <dict>
+ <key>background</key>
+ <string>#FFFFFF</string>
+ <key>caret</key>
+ <string>#000000</string>
+ <key>foreground</key>
+ <string>#000000</string>
+ <key>invisibles</key>
+ <string>#BFBFBF</string>
+ <key>lineHighlight</key>
+ <string>#00000012</string>
+ <key>selection</key>
+ <string>#A7C9FF</string>
+ </dict>
+ </dict>
+ <dict>
+ <key>name</key>
+ <string>test pass</string>
+ <key>scope</key>
+ <string>test.pass</string>
+ <key>settings</key>
+ <dict>
+ <key>foreground</key>
+ <string>#00C800</string>
+ </dict>
+ </dict>
+ <dict>
+ <key>name</key>
+ <string>test fail</string>
+ <key>scope</key>
+ <string>test.fail</string>
+ <key>settings</key>
+ <dict>
+ <key>foreground</key>
+ <string>#FF0000</string>
+ </dict>
+ </dict>
+ <dict>
+ <key>name</key>
+ <string>test comment</string>
+ <key>scope</key>
+ <string>test.comment</string>
+ <key>settings</key>
+ <dict>
+ <key>foreground</key>
+ <string>#919191</string>
+ </dict>
+ </dict>
+ <dict>
+ <key>name</key>
+ <string>test referance</string>
+ <key>scope</key>
+ <string>test.reference</string>
+ <key>settings</key>
+ <dict>
+ <key>foreground</key>
+ <string>#0000FF</string>
+ </dict>
+ </dict>
+ </array>
+ <key>uuid</key>
+ <string>19907EAE-885C-46C2-BB53-08DD1BDD9AFC</string>
+</dict>
+</plist>
View
5 guard.py
@@ -18,6 +18,7 @@ def __init__(self, listener):
self.listener = listener
self.output_view = self.listener.window.get_output_panel('guard')
self.enable_word_wrap()
+ self.set_color_scheme()
def open_file_paths(self):
return [view.file_name() for view in self.listener.window.views() if view.file_name()]
@@ -43,6 +44,10 @@ def find_project_root_path(self):
def enable_word_wrap(self):
self.output_view.settings().set("word_wrap", True)
+ def set_color_scheme(self):
+ self.output_view.settings().set("syntax", "Packages/Guard/GuardOutput.tmLanguage")
+ self.output_view.settings().set("color_scheme", "Packages/Guard/GuardOutput.tmTheme")
+
def enable_auto_show(self):
self.auto_show_enabled = True
Please sign in to comment.
Something went wrong with that request. Please try again.