diff --git a/Commands/Extend Class.tmCommand b/Commands/Extend Class.tmCommand new file mode 100644 index 0000000..e292967 --- /dev/null +++ b/Commands/Extend Class.tmCommand @@ -0,0 +1,44 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require ENV['TM_SUPPORT_PATH'] + "/lib/ui" + +class Object + def pass + yield self if block_given? + end +end + +STDIN.readlines[ 0, ENV[ 'TM_LINE_NUMBER' ].to_i ].select { |line| line[ /^[a-zA-Z0-9\-]+/ ] }.pass do |s| + # don't offer the current symbol + s[ 0, s.size - 1 ].sort.pass do |symbols| + # let the user choose a symbol to extend + TextMate::UI.menu( symbols ).pass do |choice| + unless choice.nil? + puts "@extend #{symbols[ choice ]}" + end + end + end +end + + + input + document + name + Extend Class + output + insertAsSnippet + scope + source.sass4as + tabTrigger + @ + uuid + A1A90E2E-F82F-4681-A2A8-18EC4DDDF1A4 + + diff --git a/Commands/Insert Color___.tmCommand b/Commands/Insert Color___.tmCommand new file mode 100644 index 0000000..e8e7021 --- /dev/null +++ b/Commands/Insert Color___.tmCommand @@ -0,0 +1,48 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require ENV['TM_SUPPORT_PATH'] + "/lib/ui" +require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes" +color = STDIN.read + +if color.length > 0 and color[0] != ?# + color.downcase! +end + +color = TextMate::UI.request_color(color) + +unless color.nil? + + color.upcase! + if color.length == 3 + color.gsub!(/(.)(.)(.)/,'\1\1\2\2\3\3') + end + print color + +else + + TextMate.exit_discard( ) + +end + fallbackInput + none + input + selection + keyEquivalent + @C + name + Insert Color... + output + replaceSelectedText + scope + source.sass4as + uuid + 58E899DF-56AD-41E4-AF8D-6D23B9D0066C + + diff --git a/Commands/List Variables.tmCommand b/Commands/List Variables.tmCommand new file mode 100644 index 0000000..4a93e1b --- /dev/null +++ b/Commands/List Variables.tmCommand @@ -0,0 +1,52 @@ + + + + + beforeRunningCommand + nop + command + #!/usr/bin/env ruby + +require ENV['TM_SUPPORT_PATH'] + "/lib/ui" +require ENV['TM_SUPPORT_PATH'] + "/lib/exit_codes" + +class Object + def pass + yield self if block_given? + end +end + +v = /^(\$[a-zA-Z0-9\-]+): ?(.*)/ + +STDIN.readlines[ 0, ENV[ 'TM_LINE_NUMBER' ].to_i ].select { |line| + line[ v ] +}.map { |m| + { 'title' => m[ v, 1 ], 'data' => m[ v, 2 ] } +}.pass do |s| + case s.size + when 0 + TextMate.exit_show_tool_tip "No variables declared before cursor in document." + when 1 + print s[ 0 ][ 'title' ] + else + TextMate::UI.menu( s ).pass do |choice| + unless choice.nil? + print choice[ 'title' ] + end + end + end +end + input + document + name + List Variables + output + afterSelectedText + scope + source.sass4as + tabTrigger + $ + uuid + 7E854E2B-6BC2-4C57-9FE5-8C91B74B0300 + + diff --git a/Preferences/Symbol List: Classes.tmPreferences b/Preferences/Symbol List: Classes.tmPreferences new file mode 100644 index 0000000..b33adb6 --- /dev/null +++ b/Preferences/Symbol List: Classes.tmPreferences @@ -0,0 +1,19 @@ + + + + + name + Symbol List: Classes + scope + source.sass4as entity.name.tag.sass4as + settings + + showInSymbolList + 1 + symbolTransformation + + + uuid + BA9EDF96-9420-4352-9FE4-0B334B57EBD5 + + diff --git a/Syntaxes/Sass4as.tmLanguage b/Syntaxes/Sass4as.tmLanguage new file mode 100644 index 0000000..7fc74ee --- /dev/null +++ b/Syntaxes/Sass4as.tmLanguage @@ -0,0 +1,133 @@ + + + + + fileTypes + + sass + + foldingStartMarker + \/\* + foldingStopMarker + \*\/ + keyEquivalent + ^~S + name + Sass4as + patterns + + + match + \/\*.*\*\/ + name + comment.line.sass4as + + + begin + \/\* + end + \*\/ + name + comment.block.sass4as + + + match + \b(color|text-(?:indent|decoration|align)|display|kerning|font-(?:s(?:tyle|ize)|family|weight)|le(?:tter-spacing|ading)|margin-(?:left|right))\b + name + keyword.attribute.sass4as + + + match + ^[a-zA-Z0-9\-]+ + name + entity.name.tag.sass4as + + + captures + + 1 + + name + support.function.sass4as + + 2 + + name + entity.name.tag.reference.sass4as + + + match + ^ (@extend) ([a-zA-Z0-9\-]+) + + + captures + + 1 + + name + variable.other.declaration.sass4as + + + match + ^(\$[a-zA-Z0-9\-]+): + + + match + \$[a-zA-Z0-9\-]+$ + name + variable.other.reference.sass4as + + + match + #[a-fA-F0-9]{6} + name + constant.color.sass4as + + + match + [\d\.]+(p(t|x)|em) + name + constant.font-size.sass4as + + + match + \t+ + name + invalid.illegal.spacing.sass4as + + + match + ; + name + invalid.illegal.character.sass4as + + + match + \b(s(erif|ans-serif)|center|no(ne|rmal)|true|i(nline|talic)|underline|justify|false|left|right|mono|b(old|lock))\b + name + support.constant.sass4as + + + begin + " + end + " + name + string.quoted.double.sass4as + patterns + + + match + \\. + name + constant.character.escape.untitled + + + + + scopeName + source.sass4as + uuid + 3047ACB7-2A58-4018-BC51-5C60E77AA19E + + diff --git a/info.plist b/info.plist new file mode 100644 index 0000000..c97f767 --- /dev/null +++ b/info.plist @@ -0,0 +1,18 @@ + + + + + name + Sass4as + ordering + + 58E899DF-56AD-41E4-AF8D-6D23B9D0066C + 7E854E2B-6BC2-4C57-9FE5-8C91B74B0300 + A1A90E2E-F82F-4681-A2A8-18EC4DDDF1A4 + 3047ACB7-2A58-4018-BC51-5C60E77AA19E + BA9EDF96-9420-4352-9FE4-0B334B57EBD5 + + uuid + 898A10B7-27D0-47DF-B3AD-25CE3E3E4D45 + +