feat(SublimeText2.WebPackages): cache packages

This commit is contained in:
Iristyle
2013-04-04 08:54:25 -04:00
parent 590d7a44f9
commit 1e6f643a1b
1026 changed files with 79077 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
/package-metadata.json
*.pyc
*.cache
*.sublime-project
*.sublime-workspace
Test.*
code
spec
src
lib

View File

@@ -0,0 +1,462 @@
#aponxi v0.6.0
import sublime
import sys
from os import path
import os
from subprocess import Popen, PIPE
from sublime_plugin import TextCommand
from sublime_plugin import WindowCommand
import sublime_plugin
import time
import functools
settings = sublime.load_settings('CoffeeScript.sublime-settings')
def run(cmd, args=[], source="", cwd=None, env=None):
if not type(args) is list:
args = [args]
if sys.platform == "win32":
proc = Popen([cmd] + args, env=env, cwd=cwd, stdout=PIPE, stdin=PIPE, stderr=PIPE, shell=True)
stat = proc.communicate(input=source.encode('utf-8'))
else:
if env is None:
env = {"PATH": settings.get('binDir', '/usr/local/bin')}
if source == "":
command = [cmd] + args
else:
command = [cmd] + args + [source]
# print "Debug - coffee command: "
# print command
proc = Popen(command, env=env, cwd=cwd, stdout=PIPE, stderr=PIPE)
stat = proc.communicate()
okay = proc.returncode == 0
return {"okay": okay, "out": stat[0].decode('utf-8'), "err": stat[1].decode('utf-8')}
def brew(args, source):
if sys.platform == "win32":
args.append("-s")
else:
args.append("-e")
return run("coffee", args=args, source=source)
def cake(task, cwd):
return run("cake", args=task, cwd=cwd)
def isCoffee(view=None):
if view is None:
view = sublime.active_window().active_view()
return 'source.coffee' in view.scope_name(0)
class Text():
@staticmethod
def all(view):
return view.substr(sublime.Region(0, view.size()))
@staticmethod
def sel(view):
text = []
for region in view.sel():
if region.empty():
continue
text.append(view.substr(region))
return "".join(text)
@staticmethod
def get(view):
text = Text.sel(view)
if len(text) > 0:
return text
return Text.all(view)
class CompileCommand(TextCommand):
def is_enabled(self):
return isCoffee(self.view)
def run(self, *args, **kwargs):
no_wrapper = settings.get('noWrapper', True)
compile_dir = settings.get('compileDir')
args = ['-c', self.view.file_name()]
# print self.view.file_name()
if no_wrapper:
args = ['-b'] + args
# print compile_dir
# print isinstance(compile_dir, unicode)
if compile_dir and isinstance(compile_dir, str) or isinstance(compile_dir, unicode):
print "Compile dir specified: " + compile_dir
if not os.path.exists(compile_dir):
os.makedirs(compile_dir)
print "Compile dir did not exist, created folder: " + compile_dir
folder, file_nm = os.path.split(self.view.file_name())
print folder
args = ['--output', compile_dir] + args
# print args
# print args
result = run("coffee", args=args)
if result['okay'] is True:
status = 'Compilation Succeeded'
else:
status = 'Compilation Failed'
sublime.status_message(status)
class CompileAndDisplayCommand(TextCommand):
def is_enabled(self):
return isCoffee(self.view)
def run(self, edit, **kwargs):
output = self.view.window().new_file()
output.set_scratch(True)
opt = kwargs["opt"]
if opt == '-p':
output.set_syntax_file('Packages/JavaScript/JavaScript.tmLanguage')
no_wrapper = settings.get('noWrapper', True)
args = [opt]
print args
if no_wrapper:
args = ['-b'] + args
res = brew(args, Text.get(self.view))
if res["okay"] is True:
output.insert(edit, 0, res["out"])
else:
output.insert(edit, 0, res["err"].split("\n")[0])
class CheckSyntaxCommand(TextCommand):
def is_enabled(self):
return isCoffee(self.view)
def run(self, edit):
res = brew(['-b', '-p'], Text.get(self.view))
if res["okay"] is True:
status = 'Valid'
else:
status = res["err"].split("\n")[0]
sublime.status_message('Syntax %s' % status)
class RunScriptCommand(WindowCommand):
def finish(self, text):
if text == '':
return
text = "{puts, print} = require 'util'\n" + text
res = brew(['-b'], text)
if res["okay"] is True:
output = self.window.new_file()
output.set_scratch(True)
edit = output.begin_edit()
output.insert(edit, 0, res["out"])
output.end_edit(edit)
else:
sublime.status_message('Syntax %s' % res["err"].split("\n")[0])
def run(self):
sel = Text.sel(sublime.active_window().active_view())
if len(sel) > 0:
if not isCoffee():
return
self.finish(sel)
else:
self.window.show_input_panel('Coffee >', '', self.finish, None, None)
class RunCakeTaskCommand(WindowCommand):
def finish(self, task):
if task == '':
return
if not self.window.folders():
cakepath = path.dirname(self.window.active_view().file_name())
else:
cakepath = path.join(self.window.folders()[0], 'Cakefile')
if not path.exists(cakepath):
cakepath = path.dirname(self.window.active_view().file_name())
if not path.exists(cakepath):
return sublime.status_message("Cakefile not found.")
res = cake(task, cakepath)
if res["okay"] is True:
if "No such task" in res["out"]:
msg = "doesn't exist"
else:
msg = "suceeded"
else:
msg = "failed"
sublime.status_message("Task %s - %s." % (task, msg))
def run(self):
self.window.show_input_panel('Cake >', '', self.finish, None, None)
# _
# __ _ _ __ ___ _ __ __ _(_)
# / _` | '_ \ / _ \| '_ \\ \/ / |
# | (_| | |_) | (_) | | | |> <| |
# \__,_| .__/ \___/|_| |_/_/\_\_|
# |_|
def watched_filename(view_id):
view = ToggleWatch.views[view_id]['input_obj']
if view.file_name() is not None:
filename = view.file_name().split('/')[-1]
else:
filename = "Unsaved File"
return filename
class ToggleWatch(TextCommand):
views = {}
outputs = {}
def is_enabled(self):
return isCoffee(self.view)
def run(self, edit):
myvid = self.view.id()
if not myvid in ToggleWatch.views:
views = ToggleWatch.views
views[myvid] = {'watched': True, 'modified': True, 'input_closed': False}
views[myvid]["input_obj"] = self.view
print "Now watching", watched_filename(myvid)
createOut(myvid)
else:
views = ToggleWatch.views
views[myvid]['watched'] = not views[myvid]['watched']
if not views[myvid]['watched']:
print "Stopped watching", watched_filename(myvid)
if views[myvid]['output_open'] is False:
print "Openning output and watching", watched_filename(myvid)
createOut(myvid)
elif views[myvid]['watched'] is True:
print "Resuming watching", watched_filename(myvid)
refreshOut(myvid)
def cleanUp(input_view_id):
del ToggleWatch.outputs[ToggleWatch.views[input_view_id]['output_id']]
del ToggleWatch.views[input_view_id]
return
def get_output_filename(input_view_id):
input_filename = watched_filename(input_view_id)
fileName, fileExtension = os.path.splitext(input_filename)
output_filename = fileName + '.js'
return output_filename
def createOut(input_view_id):
#create output panel and save
this_view = ToggleWatch.views[input_view_id]
outputs = ToggleWatch.outputs
#print this_view
input_filename = watched_filename(input_view_id)
print input_filename
output = this_view["input_obj"].window().new_file()
output.set_scratch(True)
output.set_syntax_file('Packages/JavaScript/JavaScript.tmLanguage')
this_view['output_id'] = output.id()
this_view["output_obj"] = output
this_view["output_open"] = True
# setting output filename
# print output.settings().set('filename', '[Compiled]' + input_filename)
# Getting file extension
output_filename = get_output_filename(input_view_id)
output.set_name(output_filename)
if not output.id() in outputs:
outputs[output.id()] = {'boundto': input_view_id}
refreshOut(input_view_id)
return output
def refreshOut(view_id):
this_view = ToggleWatch.views[view_id]
this_view['last_modified'] = time.mktime(time.gmtime())
#refresh the output view
no_wrapper = settings.get('noWrapper', True)
args = ['-p']
if no_wrapper:
args = ['-b'] + args
res = brew(args, Text.get(this_view['input_obj']))
output = this_view['output_obj']
this_view['modified'] = False
if res["okay"] is True:
edit = output.begin_edit()
output.erase(edit, sublime.Region(0, output.size()))
output.insert(edit, 0, res["out"])
output.end_edit(edit)
print "Refreshed"
else:
edit = output.begin_edit()
output.erase(edit, sublime.Region(0, output.size()))
output.insert(edit, 0, res["err"].split("\n")[0])
output.end_edit(edit)
return
def isView(view_id):
# are they modifying a view (rather than a panel, etc.)
if not view_id:
return False
window = sublime.active_window()
view = window.active_view() if window != None else None
return (view is not None and view.id() == view_id)
def close_output(input_id):
views = ToggleWatch.views
v = views[input_id]
output = v['output_obj']
# output_id = v['output_id']
# print "close output"
if v['output_open'] is True:
#print "the output is open so we should attempt to close it"
output.window().focus_view(output)
output.window().run_command("close")
print watched_filename(input_id), "was closed. Closing the Output"
#v['output_open'] = False
cleanUp(input_id)
return
class CaptureEditing(sublime_plugin.EventListener):
def handleTimeout(self, vid):
this_view = ToggleWatch.views[vid]
modified = this_view['modified']
if modified is True:
# been 1000ms since the last modification
#print "handling"
refreshOut(vid)
def on_modified(self, view):
vid = view.id()
watch_modified = settings.get('watchOnModified')
if watch_modified is not False and vid in ToggleWatch.views:
if watch_modified is True:
delay = 0.5
elif watch_modified < 0.5:
delay = 0.5
else:
delay = watch_modified
#then we have a watched input.
this_view = ToggleWatch.views[vid]
#print " this view is ", this_view
if this_view['modified'] is False:
this_view['modified'] = True
#print " trigger "
if this_view['watched'] is True:
sublime.set_timeout(functools.partial(self.handleTimeout, vid), int(delay * 1000))
return
def on_post_save(self, view):
# print "isCoffee " + str(isCoffee())
watch_save = settings.get('watchOnSave', True)
if watch_save:
save_id = view.id()
views = ToggleWatch.views
if save_id in views:
# getting view object
save_view = ToggleWatch.views[save_id]
# check if modified
if save_view['modified'] is True:
refreshOut(save_id)
compile_on_save = settings.get('compileOnSave', True)
if compile_on_save is True and isCoffee() is True:
print "Compiling on save..."
view.run_command("compile")
show_compile_output_on_save = settings.get('showOutputOnSave', True)
if show_compile_output_on_save is True and isCoffee() is True and CompileOutput.IS_OPEN is True:
print "Updating output panel..."
view.run_command("compile_output")
return
def on_close(self, view):
close_id = view.id()
views = ToggleWatch.views
if close_id in views:
#this is an input
#print "input was closed"
views[close_id]['input_closed'] = True
close_output(close_id)
if close_id in ToggleWatch.outputs and views[ToggleWatch.outputs[close_id]['boundto']]['input_closed'] is not True:
#this is an output
#print "an output was closed!"
boundview = ToggleWatch.outputs[close_id]['boundto']
thatview = views[boundview]
thatview['output_open'] = False
thatview['watched'] = False
filename = watched_filename(boundview)
print "The output was closed. No longer watching", filename
return
class CompileOutput(TextCommand):
PANEL_NAME = 'coffee_compile_output'
IS_OPEN = False
def is_enabled(self):
return isCoffee(self.view)
def run(self, edit):
window = self.view.window()
#refresh the output view
no_wrapper = settings.get('noWrapper', True)
# args = ['-p']
if no_wrapper:
args = ['-b']
res = brew(args, Text.get(self.view))
panel = window.get_output_panel(self.PANEL_NAME)
panel.set_syntax_file('Packages/JavaScript/JavaScript.tmLanguage')
panel.set_read_only(False)
output = panel
# print res["err"]
if res["okay"] is True:
edit = output.begin_edit()
output.erase(edit, sublime.Region(0, output.size()))
output.insert(edit, 0, res["out"])
output.end_edit(edit)
# print "Refreshed"
else:
edit = output.begin_edit()
output.erase(edit, sublime.Region(0, output.size()))
output.insert(edit, 0, res["err"])
output.end_edit(edit)
output.sel().clear()
output.set_read_only(True)
window.run_command('show_panel', {'panel': 'output.%s' % self.PANEL_NAME})
self.IS_OPEN = True
return

View File

@@ -0,0 +1,13 @@
{
"cmd": ["cake", "sbuild"]
, "path": "/usr/local/bin:$PATH"
, "selector": "source.coffee"
, "working_dir": "$project_path"
, "variants":
[
{
"name": "Run",
"cmd": ["coffee", "$file"]
}
]
}

View File

@@ -0,0 +1,42 @@
[
{
"caption": "Coffee: Check Syntax"
, "command": "check_syntax"
}
, {
"caption": "Coffee: Run Script"
, "command": "run_script"
}
, {
"caption": "Coffee: Run Cake Task"
, "command": "run_cake_task"
}
, {
"caption": "Coffee: Compile File"
, "command": "compile"
}
, {
"caption": "Coffee: Display JavaScript"
, "command": "compile_and_display", "args": {"opt": "-p"}
}
, {
"caption": "Coffee: Display Lexer Tokens"
, "command": "compile_and_display", "args": {"opt": "-t"}
}
, {
"caption": "Coffee: Display Parse Tree"
, "command": "compile_and_display", "args": {"opt": "-n"}
}
, {
"caption": "Coffee: Toggle Watch Mode"
, "command": "toggle_watch"
}
, {
"caption": "Coffee: Toggle Output Panel"
, "command": "toggle_output_panel"
}
, {
"caption": "Coffee: Show Compiled"
, "command": "compile_output"
}
]

View File

@@ -0,0 +1,52 @@
{
/*
The directory containing your coffee binary. Usually
/usr/local/bin.
*/
"binDir": "/usr/local/bin"
/*
Compile without the top-level function wrapper (coffee -b).
*/
, "noWrapper": true
/*
Enable or disable refresh the compiled Output on Save.
Only available for watch mode.
*/
, "watchOnSave": true
/*
Enable refreshing compiled JS when CoffeeScript is modified.
Put false to disable
Put a number of seconds to delay the refresh
*/
, "watchOnModified": 0.5
/*
Enable Compiling on save. It will compile into the same folder.
*/
, "compileOnSave": true
/*
## Enable outputting the results of the compiled coffeescript in a panel
*/
, "showOutputOnSave": false
/*
## Enable compiling to a specific directory.
#### Description
if it is a string like 'some/directory' then `-o some/directory` will be added to `coffee` compiler.
if it is false or not string then it will compile your `script.coffee` to the directory it is in.
#### Example:
Directory is relative to the file you are editting if specified such as
compileDir": "out"
Directory is absolute if specified such as
compileDir": "/home/logan/Desktop/out"
*/
, "compileDir": false
}

View File

@@ -0,0 +1,746 @@
<?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>CoffeeScript Syntax: version 1</string>
<key>fileTypes</key>
<array>
<string>coffee</string>
<string>Cakefile</string>
<string>coffee.erb</string>
<string>cson</string>
</array>
<key>firstLineMatch</key>
<string>^#!.*\bcoffee</string>
<key>foldingStartMarker</key>
<string>^\s*class\s+\S.*$|.*(-&gt;|=&gt;)\s*$|.*[\[{]\s*$</string>
<key>foldingStopMarker</key>
<string>^\s*$|^\s*[}\]]\s*$</string>
<key>keyEquivalent</key>
<string>^~C</string>
<key>name</key>
<string>CoffeeScript</string>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>variable.parameter.function.coffee</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>storage.type.function.coffee</string>
</dict>
</dict>
<key>comment</key>
<string>match stuff like: a -&gt; … </string>
<key>match</key>
<string>(\([^()]*?\))\s*([=-]&gt;)</string>
<key>name</key>
<string>meta.inline.function.coffee</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>keyword.operator.new.coffee</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>support.class.coffee</string>
</dict>
</dict>
<key>match</key>
<string>(new)\s+(\w+(?:\.\w*)*)</string>
<key>name</key>
<string>meta.class.instance.constructor</string>
</dict>
<dict>
<key>begin</key>
<string>'''</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.coffee</string>
</dict>
</dict>
<key>end</key>
<string>'''</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.coffee</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.heredoc.coffee</string>
</dict>
<dict>
<key>begin</key>
<string>"""</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.coffee</string>
</dict>
</dict>
<key>end</key>
<string>"""</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.coffee</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.heredoc.coffee</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\.</string>
<key>name</key>
<string>constant.character.escape.coffee</string>
</dict>
<dict>
<key>include</key>
<string>#interpolated_coffee</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>`</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.coffee</string>
</dict>
</dict>
<key>end</key>
<string>`</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.coffee</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.script.coffee</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)</string>
<key>name</key>
<string>constant.character.escape.coffee</string>
</dict>
</array>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;!#)###(?!#)</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.coffee</string>
</dict>
</dict>
<key>end</key>
<string>###(?:[ \t]*\n)</string>
<key>name</key>
<string>comment.block.coffee</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>@\w*</string>
<key>name</key>
<string>storage.type.annotation.coffeescript</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.coffee</string>
</dict>
</dict>
<key>match</key>
<string>(#)(?!\{).*$\n?</string>
<key>name</key>
<string>comment.line.number-sign.coffee</string>
</dict>
<dict>
<key>begin</key>
<string>/{3}</string>
<key>end</key>
<string>/{3}[imgy]{0,4}</string>
<key>name</key>
<string>string.regexp.coffee</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#interpolated_coffee</string>
</dict>
<dict>
<key>include</key>
<string>#embedded_comment</string>
</dict>
</array>
</dict>
<dict>
<key>match</key>
<string>/(?![\s=/*+{}?]).*?[^\\]/[igmy]{0,4}(?![a-zA-Z0-9])</string>
<key>name</key>
<string>string.regexp.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)
\b(?&lt;![\.\$])(
break|by|catch|continue|else|finally|for|in|of|if|return|switch|
then|throw|try|unless|when|while|until|loop|do|(?&lt;=for)\s+own
)(?!\s*:)\b
</string>
<key>name</key>
<string>keyword.control.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)
and=|or=|!|%|&amp;|\^|\*|\/|(\-)?\-(?!&gt;)|\+\+|\+|~|==|=(?!&gt;)|!=|&lt;=|&gt;=|&lt;&lt;=|&gt;&gt;=|
&gt;&gt;&gt;=|&lt;&gt;|&lt;|&gt;|!|&amp;&amp;|\.\.(\.)?|\?|\||\|\||\:|\*=|(?&lt;!\()/=|%=|\+=|\-=|&amp;=|
\^=|\b(?&lt;![\.\$])(instanceof|new|delete|typeof|and|or|is|isnt|not|super)\b
</string>
<key>name</key>
<string>keyword.operator.coffee</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>variable.assignment.coffee</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>punctuation.separator.key-value</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>keyword.operator.coffee</string>
</dict>
</dict>
<key>match</key>
<string>([a-zA-Z\$_](\w|\$|\.)*\s*(?!\::)((:)|(=[^=]))(?!(\s*\(.*\))?\s*((=|-)&gt;)))</string>
<key>name</key>
<string>variable.assignment.coffee</string>
</dict>
<dict>
<key>begin</key>
<string>(?&lt;=\s|^)([\[\{])(?=.*?[\]\}]\s+[:=])</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>keyword.operator.coffee</string>
</dict>
</dict>
<key>end</key>
<string>([\]\}]\s*[:=])</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>keyword.operator.coffee</string>
</dict>
</dict>
<key>name</key>
<string>meta.variable.assignment.destructured.coffee</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>#variable_name</string>
</dict>
<dict>
<key>include</key>
<string>#instance_variable</string>
</dict>
<dict>
<key>include</key>
<string>#single_quoted_string</string>
</dict>
<dict>
<key>include</key>
<string>#double_quoted_string</string>
</dict>
<dict>
<key>include</key>
<string>#numeric</string>
</dict>
</array>
</dict>
<dict>
<key>captures</key>
<dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.function.coffee</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>entity.name.function.coffee</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>variable.parameter.function.coffee</string>
</dict>
<key>5</key>
<dict>
<key>name</key>
<string>storage.type.function.coffee</string>
</dict>
</dict>
<key>match</key>
<string>(?x)
(\s*)
(?=[a-zA-Z\$_])
(
[a-zA-Z\$_](\w|\$|:|\.)*\s*
(?=[:=](\s*\(.*\))?\s*([=-]&gt;))
)
</string>
<key>name</key>
<string>meta.function.coffee</string>
</dict>
<dict>
<key>comment</key>
<string>Show well-known functions from Express and Mocha in Go To Symbol view</string>
<key>name</key>
<string>meta.function.symbols.coffee</string>
<key>begin</key>
<string>^\s*(describe|it|app\.(get|post|put|all|del|delete))</string>
<key>end</key>
<string>$</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$self</string>
</dict>
</array>
</dict>
<dict>
<key>match</key>
<string>[=-]&gt;</string>
<key>name</key>
<string>storage.type.function.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\b(?&lt;!\.)(true|on|yes)(?!\s*[:=])\b</string>
<key>name</key>
<string>constant.language.boolean.true.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\b(?&lt;!\.)(false|off|no)(?!\s*[:=])\b</string>
<key>name</key>
<string>constant.language.boolean.false.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\b(?&lt;!\.)null(?!\s*[:=])\b</string>
<key>name</key>
<string>constant.language.null.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\b(?&lt;!\.)(this|extends)(?!\s*[:=])\b</string>
<key>name</key>
<string>variable.language.coffee</string>
</dict>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>storage.type.class.coffee</string>
</dict>
<key>2</key>
<dict>
<key>name</key>
<string>entity.name.type.class.coffee</string>
</dict>
<key>3</key>
<dict>
<key>name</key>
<string>keyword.control.inheritance.coffee</string>
</dict>
<key>4</key>
<dict>
<key>name</key>
<string>entity.other.inherited-class.coffee</string>
</dict>
</dict>
<key>match</key>
<string>(class\b)\s+(@?[a-zA-Z\$_][\w\.]*)?(?:\s+(extends)\s+(@?[a-zA-Z\$\._][\w\.]*))?</string>
<key>name</key>
<string>meta.class.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\b(debugger|\\)\b</string>
<key>name</key>
<string>keyword.other.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)\b(
Array|ArrayBuffer|Blob|Boolean|Date|document|event|Function|
Int(8|16|32|64)Array|Math|Map|Number|
Object|Proxy|RegExp|Set|String|WeakMap|
window|Uint(8|16|32|64)Array|XMLHttpRequest
)\b</string>
<key>name</key>
<string>support.class.coffee</string>
</dict>
<dict>
<key>match</key>
<string>((?&lt;=console\.)(debug|warn|info|log|error|time|timeEnd|assert))\b</string>
<key>name</key>
<string>support.function.console.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)\b(
decodeURI(Component)?|encodeURI(Component)?|eval|parse(Float|Int)|require
)\b</string>
<key>name</key>
<string>support.function.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)((?&lt;=\.)(
apply|call|concat|every|filter|forEach|from|hasOwnProperty|indexOf|
isPrototypeOf|join|lastIndexOf|map|of|pop|propertyIsEnumerable|push|
reduce(Right)?|reverse|shift|slice|some|sort|splice|to(Locale)?String|
unshift|valueOf
))\b</string>
<key>name</key>
<string>support.function.method.array.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)((?&lt;=Array\.)(
isArray
))\b</string>
<key>name</key>
<string>support.function.static.array.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)((?&lt;=Object\.)(
create|definePropert(ies|y)|freeze|getOwnProperty(Descriptors?|Names)|
getProperty(Descriptor|Names)|getPrototypeOf|is(Extensible|Frozen|Sealed)?|
isnt|keys|preventExtensions|seal
))\b</string>
<key>name</key>
<string>support.function.static.object.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)((?&lt;=Math\.)(
abs|acos|acosh|asin|asinh|atan|atan2|atanh|ceil|cos|cosh|exp|expm1|floor|
hypot|log|log10|log1p|log2|max|min|pow|random|round|sign|sin|sinh|sqrt|
tan|tanh|trunc
))\b</string>
<key>name</key>
<string>support.function.static.math.coffee</string>
</dict>
<dict>
<key>match</key>
<string>(?x)((?&lt;=Number\.)(
is(Finite|Integer|NaN)|toInteger
))\b</string>
<key>name</key>
<string>support.function.static.number.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\b(Infinity|NaN|undefined)\b</string>
<key>name</key>
<string>constant.language.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\;</string>
<key>name</key>
<string>punctuation.terminator.statement.coffee</string>
</dict>
<dict>
<key>match</key>
<string>,[ |\t]*</string>
<key>name</key>
<string>meta.delimiter.object.comma.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\.</string>
<key>name</key>
<string>meta.delimiter.method.period.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\{|\}</string>
<key>name</key>
<string>meta.brace.curly.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\(|\)</string>
<key>name</key>
<string>meta.brace.round.coffee</string>
</dict>
<dict>
<key>match</key>
<string>\[|\]\s*</string>
<key>name</key>
<string>meta.brace.square.coffee</string>
</dict>
<dict>
<key>include</key>
<string>#instance_variable</string>
</dict>
<dict>
<key>include</key>
<string>#single_quoted_string</string>
</dict>
<dict>
<key>include</key>
<string>#double_quoted_string</string>
</dict>
<dict>
<key>include</key>
<string>#numeric</string>
</dict>
</array>
<key>repository</key>
<dict>
<key>double_quoted_string</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>"</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.coffee</string>
</dict>
</dict>
<key>end</key>
<string>"</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.coffee</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.double.coffee</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]|37[0-7]?|[4-7][0-7]?|.)</string>
<key>name</key>
<string>constant.character.escape.coffee</string>
</dict>
<dict>
<key>include</key>
<string>#interpolated_coffee</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>embedded_comment</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>punctuation.definition.comment.coffee</string>
</dict>
</dict>
<key>match</key>
<string>(?&lt;!\\)(#).*$\n?</string>
<key>name</key>
<string>comment.line.number-sign.coffee</string>
</dict>
</array>
</dict>
<key>instance_variable</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(@)([a-zA-Z_\$]\w*)?</string>
<key>name</key>
<string>variable.other.readwrite.instance.coffee</string>
</dict>
</array>
</dict>
<key>interpolated_coffee</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>\#\{</string>
<key>captures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.section.embedded.coffee</string>
</dict>
</dict>
<key>end</key>
<string>\}</string>
<key>name</key>
<string>source.coffee.embedded.source</string>
<key>patterns</key>
<array>
<dict>
<key>include</key>
<string>$self</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>numeric</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>(?&lt;!\$)\b((0([box])[0-9a-fA-F]+)|([0-9]+(\.[0-9]+)?(e[+\-]?[0-9]+)?))\b</string>
<key>name</key>
<string>constant.numeric.coffee</string>
</dict>
</array>
</dict>
<key>single_quoted_string</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>begin</key>
<string>'</string>
<key>beginCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.begin.coffee</string>
</dict>
</dict>
<key>end</key>
<string>'</string>
<key>endCaptures</key>
<dict>
<key>0</key>
<dict>
<key>name</key>
<string>punctuation.definition.string.end.coffee</string>
</dict>
</dict>
<key>name</key>
<string>string.quoted.single.coffee</string>
<key>patterns</key>
<array>
<dict>
<key>match</key>
<string>\\(x\h{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)</string>
<key>name</key>
<string>constant.character.escape.coffee</string>
</dict>
</array>
</dict>
</array>
</dict>
<key>variable_name</key>
<dict>
<key>patterns</key>
<array>
<dict>
<key>captures</key>
<dict>
<key>1</key>
<dict>
<key>name</key>
<string>variable.assignment.coffee</string>
</dict>
</dict>
<key>match</key>
<string>([a-zA-Z\$_]\w*(\.\w+)*)</string>
<key>name</key>
<string>variable.assignment.coffee</string>
</dict>
</array>
</dict>
</dict>
<key>scopeName</key>
<string>source.coffee</string>
</dict>
</plist>

View File

@@ -0,0 +1,34 @@
<?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>Comments</string>
<key>scope</key>
<string>source.coffee</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string># </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>###</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string>###</string>
</dict>
</array>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,25 @@
<?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>Indent</string>
<key>scope</key>
<string>source.coffee</string>
<key>settings</key>
<dict>
<key>decreaseIndentPattern</key>
<string>^\s*(\}|\]|else|catch|finally)$</string>
<key>increaseIndentPattern</key>
<string>(?x)
^\s*
(.*class
|[a-zA-Z\$_](\w|\$|:|\.)*\s*(?=\:(\s*\(.*\))?\s*((=|-)&gt;\s*$)) # function that is not one line
|[a-zA-Z\$_](\w|\$|\.)*\s*(:|=)\s*((if|while)(?!.*?then)|for|$) # assignment using multiline if/while/for
|(if|while)\b(?!.*?then)|for\b
|(try|finally|catch\s+\S.*)\s*$
|.*[-=]&gt;$
|.*[\{\[]$)</string>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,11 @@
[
{"keys": ["alt+shift+s"], "command": "check_syntax"}
, {"keys": ["alt+shift+r"], "command": "run_script"}
, {"keys": ["alt+shift+t"], "command": "run_cake_task"}
, {"keys": ["alt+shift+c"], "command": "compile"}
, {"keys": ["alt+shift+d"], "command": "compile_and_display", "args": {"opt": "-p"}}
, {"keys": ["alt+shift+l"], "command": "compile_and_display", "args": {"opt": "-t"}}
, {"keys": ["alt+shift+n"], "command": "compile_and_display", "args": {"opt": "-n"}}
, {"keys": ["alt+shift+w"], "command": "toggle_watch"}
, {"keys": ["alt+shift+z"], "command": "toggle_output_panel"}
]

View File

@@ -0,0 +1,11 @@
[
{"keys": ["alt+shift+s"], "command": "check_syntax"}
, {"keys": ["alt+shift+r"], "command": "run_script"}
, {"keys": ["alt+shift+t"], "command": "run_cake_task"}
, {"keys": ["alt+shift+c"], "command": "compile"}
, {"keys": ["alt+shift+d"], "command": "compile_and_display", "args": {"opt": "-p"}}
, {"keys": ["alt+shift+x"], "command": "compile_and_display", "args": {"opt": "-t"}}
, {"keys": ["alt+shift+n"], "command": "compile_and_display", "args": {"opt": "-n"}}
, {"keys": ["alt+shift+w"], "command": "toggle_watch"}
, {"keys": ["alt+shift+z"], "command": "toggle_output_panel"}
]

View File

@@ -0,0 +1,11 @@
[
{"keys": ["alt+shift+s"], "command": "check_syntax"}
, {"keys": ["alt+shift+r"], "command": "run_script"}
, {"keys": ["alt+shift+t"], "command": "run_cake_task"}
, {"keys": ["alt+shift+c"], "command": "compile"}
, {"keys": ["alt+shift+d"], "command": "compile_and_display", "args": {"opt": "-p"}}
, {"keys": ["alt+shift+l"], "command": "compile_and_display", "args": {"opt": "-t"}}
, {"keys": ["alt+shift+n"], "command": "compile_and_display", "args": {"opt": "-n"}}
, {"keys": ["alt+shift+w"], "command": "toggle_watch"}
, {"keys": ["alt+shift+z"], "command": "toggle_output_panel"}
]

View File

@@ -0,0 +1,3 @@
[
{ "command": "compile_output" }
]

View File

@@ -0,0 +1,59 @@
[
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children":
[
{
"caption": "Package Settings",
"mnemonic": "P",
"id": "package-settings",
"children":
[
{
"caption": "Better Coffeescript",
"children":
[
{
"command": "open_file",
"args": {"file": "${packages}/sublime-better-coffeescript/CoffeeScript.sublime-settings"},
"caption": "Settings Default"
},
{
"command": "open_file",
"args": {"file": "${packages}/User/CoffeeScript.sublime-settings"},
"caption": "Settings User"
},
{
"command": "open_file",
"args": {
"file": "${packages}/sublime-better-coffeescript/Keymaps/Default (Windows).sublime-keymap",
"platform": "Windows"
},
"caption": "Key Bindings Default"
},
{
"command": "open_file",
"args": {
"file": "${packages}/sublime-better-coffeescript/Keymaps/Default (OSX).sublime-keymap",
"platform": "OSX"
},
"caption": "Key Bindings Default"
},
{
"command": "open_file",
"args": {
"file": "${packages}/sublime-better-coffeescript/Keymaps/Default (Linux).sublime-keymap",
"platform": "Linux"
},
"caption": "Key Bindings Default"
},
{ "caption": "-" }
]
}
]
}
]
}
]

View File

@@ -0,0 +1,296 @@
__
__ _____ ___ ___ __ _/\_\
/'__`\ /\ '__`\ / __`\ /' _ `\ /\ \/'\/\ \
/\ \L\.\_\ \ \L\ \/\ \L\ \/\ \/\ \\/> </\ \ \
\ \__/.\_\\ \ ,__/\ \____/\ \_\ \_\/\_/\_\\ \_\
\/__/\/_/ \ \ \/ \/___/ \/_/\/_/\//\/_/ \/_/
\ \_\
\/_/
____ __ __
/\ _`\ /\ \__/\ \__
\ \ \L\ \ __\ \ ,_\ \ ,_\ __ _ __
\ \ _ <' /'__`\ \ \/\ \ \/ /'__`\/\`'__\
\ \ \L\ \/\ __/\ \ \_\ \ \_/\ __/\ \ \/
\ \____/\ \____\\ \__\\ \__\ \____\\ \_\
\/___/ \/____/ \/__/ \/__/\/____/ \/_/
___ ___ __
/'___\ /'___\ __ /\ \__
___ ___ /\ \__//\ \__/ __ __ ____ ___ _ __ /\_\ _____\ \ ,_\
/'___\ / __`\ \ ,__\ \ ,__\/'__`\ /'__`\ /',__\ /'___\/\`'__\/\ \/\ '__`\ \ \/
/\ \__//\ \L\ \ \ \_/\ \ \_/\ __//\ __//\__, `\/\ \__/\ \ \/ \ \ \ \ \L\ \ \ \_
\ \____\ \____/\ \_\ \ \_\\ \____\ \____\/\____/\ \____\\ \_\ \ \_\ \ ,__/\ \__\
\/____/\/___/ \/_/ \/_/ \/____/\/____/\/___/ \/____/ \/_/ \/_/\ \ \/ \/__/
\ \_\
\/_/
# Jump to Section
* [Latest Change Log](#latest-changelog)
* [Installation](#installation)
* [Updating](#updating)
* [Commands/Shortcuts](#commandsshortcuts)
* [Snippets](#snippets)
* [Building](#building)
* [Settings](#settings)
* [Special Thanks](#special-thanks)
# Overview
## Description
CoffeeScript plugin was originally created by Xavura. As I began writing a lot of code in CoffeeScript I felt the need for side-by-side view for compiled CoffeeScript. Since Xavura's repo have been inactive I decided to branch out my own version. The biggest change in my branch is the Watch Mode which updates the compiled JavaScript view whenever you modify the CoffeeScript thus enabling you to view your progress side-by-side.
I use this plugin everyday so whenever I am not developing I am in testing stage. I'll make sure every request or bug will be patched since I'm a frequent user.
## Contributing
- Please use [aponxi/issues page](https://github.com/aponxi/sublime-better-coffeescript/issues) to make requests or report bugs.
- It would be best to keep the wiki on [SublimeText repository's wiki](https://github.com/SublimeText/sublime-better-coffeescript/wiki).
# Installation
## via Package Control
> This is the recommended installation method.
If you have Sublime Package Control, you know what to do. If not, well: it's a package manager for Sublime Text 2; it's awesome and you can [read about it here](http://wbond.net/sublime_packages/package_control).
To install Package Control, open the Python Console (`ctrl+'` or ``cmd+` ``) and paste the following into it:
import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
After installing the package and restarting the editor:
* Open the Command Pallete (`ctrl+shift+P` or `cmd+shift+P`).
* Type "Install Package" and hit return.
* Type "sublime-better-coffeescript" and hit return.
## via Source Control
> If you plan to contribute, then you should install via this method. Otherwise it is recommended that you install the package via Package Control, see above.
Sublime stores packages in the following locations:
Nix: ~/.config/sublime-text-2/packages
Mac: ~/Library/Application\ Support/Sublime\ Text\ 2/Packages
Win: %APPDATA%\Sublime Text 2\Packages
### As a repository within the packages directory
Open a Terminal/Console and run the following commands, replacing `PACKAGE_PATH` with the path corresponding to your OS above.
cd PACKAGE_PATH
git clone https://github.com/aponxi/sublime-better-coffeescript.git "sublime-better-coffeescript"
### As a repository outside of the packages directory
If you use Github for Mac/Windows which store repositories in a specific location, or if you just don't want a repository in your packages directory, then instead you can use a link.
If you don't yet have the repository, then grab it via your GUI program or via the command line:
cd WHEREVER_YOU_WANT
git clone https://github.com/aponxi/sublime-better-coffeescript.git
Once that is done, we will create the link:
#### Windows:
cd PACKAGE_PATH
mklink /D sublime-better-coffeescript ABSOLUTE_PATH_TO_REPOSITORY
#### Nix/Mac:
cd PACKAGE_PATH
ln -s ABSOLUTE_PATH_TO_REPOSITORY sublime-better-coffeescript
#### A note on Package Control
When Package Control tries to update your packages, if you have a repository in your packages directory then it will try to pull down and merge any changes. If you don't want this to happen and would rather handle everything yourself, then you can add the following to your settings (Preferences » Package Settings » Package Control » Settings - User):
"auto_upgrade_ignore": ["sublime-better-coffeescript"]
# Updating
If you are using Package Control, updating will be automatic and you don't have to worry about it.
If using Source Control:
cd PACKAGE_PATH/CoffeeScript
git fetch origin
git merge origin/master
# Commands/Shortcuts
You can access the commands either using the command palette (`ctrl+shift+P` or `cmd+shift+P`) or via shortcuts.
alt+shift+t - Run a Cake task
alt+shift+r - Run some CoffeeScript (puts/print is available for output)
alt+shift+s - Run a syntax check
alt+shift+c - Compile a file
alt+shift+d - Display compiled JavaScript
alt+shift+l - Display lexer tokens
alt+shift+n - Display parser nodes
alt+shift+w - Toggle watch mode
alt+shift+p - Toggle output panel
Context menu has `Compile Output` that compiles the current CoffeeScript and outputs the javascript code that is run, in a panel.
**Note:** Some of the commands use the Status Bar for output, so you'll probably want to enable it (Tools » Show Status Bar).
# Snippets
- Use `TAB` to run a snippet after typing the trigger.
- Use `TAB` and `shift+TAB` to cycle forward/backward through fields.
- Use `ESC` to exit snippet mode.
### Snippet Triggers
**Comprehension**
Array: forin
Object: forof
Range: fori (inclusive)
Range: forx (exclusive)
**Statements**
If: if
Else: el
If Else: ifel
Else If: elif
Switch: swi
Ternary: ter
Try Catch: try
Unless: unl
**Classes**
Class - cla
**Other**
Function: -
Function: = (bound)
Interpolation: #
# Building
> When using the build system, it is assumed that your `.sublime-project` file lives in your project's base directory (due to limitations with the build system).
Hitting `F7` (Tools » Build) will run the Cake task 'sbuild'.
If you're not quite sure what the point of this is then read on.
Let's say before distributing your project that you would like to combine all of your `.js` files into one and then minify them them using UglifyJS or something.
That's what this is for! You would create a `Cakefile` and inside it you would write a task:
task 'sbuild', 'Prepare project for distribution.', ->
# ...
# Settings
Go to `Preferences > Package Settings > CoffeeScript > Settings - User` to change settings.
```Javascript
{
/*
The directory containing your coffee binary. Usually
/usr/local/bin.
*/
"binDir": "/usr/local/bin"
/*
Compile without the top-level function wrapper (coffee -b).
*/
, "noWrapper": true
/*
Enable or disable refresh the compiled Output on Save.
Only available for watch mode.
*/
, "watchOnSave": true
/*
Enable refreshing compiled JS when CoffeeScript is modified.
Put false to disable
Put a number of seconds to delay the refresh
*/
, "watchOnModified": 0.5
/*
Enable Compiling on save. It will compile into the same folder.
*/
, "compileOnSave": true
/*
## Enable outputting the results of the compiled coffeescript in a panel
*/
, "showOutputOnSave": false
/*
## Enable compiling to a specific directory.
#### Description
if it is a string like 'some/directory' then `-o some/directory` will be added to `coffee` compiler.
if it is false or not string then it will compile your `script.coffee` to the directory it is in.
#### Example:
Directory is relative to the file you are editting if specified such as
compileDir": "out"
Directory is absolute if specified such as
compileDir": "/home/logan/Desktop/out"
*/
, "compileDir": false
}
```
# Latest Changelog
### v0.6.3 25/Jan/2013
* added compileDir option which specifies `coffee -o` arg when compiling.
* Fixed settings file name. It was Coffeescript when it should have been CoffeeScript. Fixes #19
* compileDir path works only if it exists.
* now also works if it doesn't exist.
* changed default compileDir option to false thus compiling a coffee script to the same directory as default.
### v0.6.2 16/Jan/2013
- Updated package.json, bumped up version.
### v0.6.1 16/Jan/2013
- Added utf-8 encode/decode to prevent unicode decode errors, fixed #17
- Corrected years in 0.6 changelog... Should get used to it by now.
- Added error output in panel which fixes #16
### v0.6 Changelog - 16/Jan/2013
- Changed menu name to "Better Coffeescript"
- Changed menu arguments to be directed to `sublime-better-coffeescript` folders, settings files are still kept as `Coffeescript.sublime-settings`
- Fixed lint errors
- if delay is lower than < 0.5 then we are saying that minimum delay should be 0.5
- added a method that gets the input's filename with .js extension
- setting the output view's name as filename.js fixes #13
- added compileOnSave option fixes #14
- updated readme fixes #6
- added compile output class
- added compile_output command, it displays the console.logs and what not in a panel
- added compile_output command to the context menu (right click). This only works for coffeescripts.
- Added that it existed in README.
- Added option for showOutputOnSave
- Need a way of telling if output is open or closed/hidden #15
# Special Thanks
* [agibsonsw](https://github.com/agibsonsw) for his help in writing WatchMode
* [Xavura](https://github.com/Xavura) for writing the base of this plugin

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>for ${1:i} in ${2:array}
${3:# ...}
$0</string>
<key>name</key>
<string>Array Comprehension</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>forin</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>${1:(${2:arguments}) }=&gt;
${3:# ...}
$0</string>
<key>name</key>
<string>Function (bound)</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>=</string>
</dict>
</plist>

View File

@@ -0,0 +1,18 @@
<?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>content</key>
<string>class ${1:Name}
${2:constructor: ${3:(${4:arguments}) }-&gt;
${5:# ...}}
$6
$0</string>
<key>name</key>
<string>Class</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>cla</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>console.log $0</string>
<key>name</key>
<string>log</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>log</string>
<key>uuid</key>
<string>FBC44B18-323A-4C00-A35B-15E41830C5AD</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>else if ${1:condition}
${2:# ...}
$0</string>
<key>name</key>
<string>Else if</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>elif</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>else
${1:# ...}
$0</string>
<key>name</key>
<string>Else</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>el</string>
</dict>
</plist>

View File

@@ -0,0 +1,17 @@
<?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>content</key>
<string>${1:(${2:arguments}) }-&gt;
${3:# ...}
$0
</string>
<key>name</key>
<string>Function</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>-</string>
</dict>
</plist>

View File

@@ -0,0 +1,18 @@
<?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>content</key>
<string>if ${1:condition}
${2:# ...}
else
${3:# ...}
$0</string>
<key>name</key>
<string>If Else</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>ifel</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>if ${1:condition}
${2:# ...}
$0</string>
<key>name</key>
<string>If</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>if</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>#{${1:$TM_SELECTED_TEXT}}</string>
<key>keyEquivalent</key>
<string>#</string>
<key>name</key>
<string>Interpolated Code</string>
<key>scope</key>
<string>(string.quoted.double.coffee) - string source, (string.quoted.double.heredoc.coffee) - string source</string>
<key>tabTrigger</key>
<string>#</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>for ${1:${2:k}, ${3:v}} of ${4:object}
${5:# ...}
$0</string>
<key>name</key>
<string>Object Comprehension</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>forof</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>for ${1:i} in [${2:start}...${3:finish}]${4: by ${5:step}}
${6:# ...}
$0</string>
<key>name</key>
<string>Range Comprehension (exclusive)</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>forx</string>
</dict>
</plist>

View File

@@ -0,0 +1,16 @@
<?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>content</key>
<string>for ${1:i} in [${2:start}..${3:finish}]${4: by ${5:step}}
${6:# ...}
$0</string>
<key>name</key>
<string>Range Comprehension (inclusive)</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>fori</string>
</dict>
</plist>

View File

@@ -0,0 +1,18 @@
<?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>content</key>
<string>switch ${1:object}
when ${2:value}
${3:# ...}
$4
$0</string>
<key>name</key>
<string>Switch</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>swi</string>
</dict>
</plist>

View File

@@ -0,0 +1,15 @@
<?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>content</key>
<string>if ${1:condition} then ${2:...} else ${3:...}
$0</string>
<key>name</key>
<string>Ternary If</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>ter</string>
</dict>
</plist>

View File

@@ -0,0 +1,18 @@
<?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>content</key>
<string>try
${1:# ...}
catch ${2:e}
${3:# ...}
$0</string>
<key>name</key>
<string>Try .. Catch</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>try</string>
</dict>
</plist>

View File

@@ -0,0 +1,15 @@
<?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>content</key>
<string>${1:...} unless ${2:condition}
$0</string>
<key>name</key>
<string>Unless</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>unl</string>
</dict>
</plist>

View File

@@ -0,0 +1,14 @@
<?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>content</key>
<string>${2/^.*?([\w_]+).*$/\L$1/} = require ${2:'${1:sys}'}$3</string>
<key>name</key>
<string>require</string>
<key>scope</key>
<string>source.coffee</string>
<key>tabTrigger</key>
<string>req</string>
</dict>
</plist>

View File

@@ -0,0 +1,17 @@
<?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>Symbol List</string>
<key>scope</key>
<string>source.coffee meta.class.coffee, meta.function</string>
<key>settings</key>
<dict>
<key>showInSymbolList</key>
<integer>1</integer>
</dict>
<key>uuid</key>
<string>C02A31C1-E770-472F-A13E-358FF1C6AD89</string>
</dict>
</plist>

View File

@@ -0,0 +1,10 @@
CoffeeScript-Sublime-Plugin 0.5.1 Changelog
Features
- Added the missing Compile File command (alt+shift+c). This is useful if you
just want to quickly compile a .coffee file to a .js file in the same directory.
Enhancements
- Added support for showing upgrade and installation messages, like this one.

View File

@@ -0,0 +1,9 @@
CoffeeScript-Sublime-Plugin 0.5.2 Changelog
Changes
- On Mac OS, the shortcut for displaying lexer tokens has changed to alt+shift+x (for leXer tokens). This is because alt+shift+l is used to insert a pipe character on French keyboards.
Enhancements
- Improved the documentation.

View File

@@ -0,0 +1,13 @@
CoffeeScript-Sublime-Plugin 0.5.2 Changelog
Fixes
- Several syntax highlighting issues.
- Respect noWrapper setting when compiling.
Enhancements
- Added a build variant to quickly display the output of the current
script via (ctrl+shift+B or cmd+shift+B).
- CSON files are now recognised.
- Go To Symbol improvements (see: http://i.stack.imgur.com/2vssw.png).

View File

@@ -0,0 +1,21 @@
# Changelog
## Version 0.5.4 History by [aponxi](https://github.com/aponxi)
### Log:
* Added Settings to the Package Settings Menu
* Added the following Settings:
* `watchOnModified` :
Can be `False`, `True`, or an `Integer`.
1. If its `false`, the watched CoffeeScript won't be compiled when modified
2. If its an `Integer` the watched CoffeeScript will be compiled when modified after X seconds. (If you put in 3 then it will be modified only if it has been 3 seconds after the last compile, if you don't make any modifications though, it won't compile until you do)
3. If its `true` ( _default_ ), the watched CoffeeScript will be compiled when modified after 3 seconds.
* `watchOnSaved` :
Can be `True` or `False`.
This enables compiling when the CoffeeScript you were editing is Saved.
* Added Watch Support
By default you can press `alt+shift+w` to start the watch mode. It will open an output view which you can close to stop watching. When you are watching your CoffeeScript the compiled output will be inserted in the output view at the begining. After that you can either compile when you modify the CoffeeScript or when you Save it, or both. You can set these settings by going into the package settings. Use the User Settings so that if you upgrade, you won't lose your settings.
### Known Issues:
1. [Issue #1](https://github.com/aponxi/CoffeeScript-Sublime-Plugin/issues/1): If you are watching the file and it compiles whenever you modify without delay, then Sublime Text 2 can be unresponsive. Until this is fixed, please use a delay on `watchOnModified` setting, by either setting it to True, False or something > 0.

View File

@@ -0,0 +1,22 @@
# Changelog
## Version 0.5.5 History by [aponxi](https://github.com/aponxi)
### Log:
* Fixed refreshing on modified. Now there is always a delay by default which is 0.5 seconds.
* Now closing the CoffeeScript closes the Compiled JS output.
* When you close the Compiled JS Output view, you stop watch mode.
* `alt+shift+w` successfully toggles watchmode on and off.
* When the CoffeeScript is closed upon watch mode, the code is cleaned up.
* Fixed output messages.
* Removed unused settings
The code runs smoother now. Doesn't slow down.
On this version worked heavily on WatchMode. And it was a hell of a work!
_
__ _ _ __ ___ _ __ __ _(_)
/ _` | '_ \ / _ \| '_ \\ \/ / |
| (_| | |_) | (_) | | | |> <| |
\__,_| .__/ \___/|_| |_/_/\_\_|
|_|

View File

@@ -0,0 +1,14 @@
# Changelog
## Version 0.5.6 History by [aponxi](https://github.com/aponxi)
### Log:
* Fixed some minor issues which disabled update on modified
* Now after creating output panel, it refreshes.
_
__ _ _ __ ___ _ __ __ _(_)
/ _` | '_ \ / _ \| '_ \\ \/ / |
| (_| | |_) | (_) | | | |> <| |
\__,_| .__/ \___/|_| |_/_/\_\_|
|_|

View File

@@ -0,0 +1,31 @@
# v0.6.3 25/Jan/2013
* added compileDir option which specifies `coffee -o` arg when compiling.
* Fixed settings file name. It was Coffeescript when it should have been CoffeeScript. Fixes #19
* compileDir path works only if it exists.
* now also works if it doesn't exist.
* changed default compileDir option to false thus compiling a coffee script to the same directory as default.
# v0.6.2 16/Jan/2013
- Updated package.json, bumped up version.
# v0.6.1 16/Jan/2013
- Added utf-8 encode/decode to prevent unicode decode errors, fixed #17
- Corrected years in 0.6 changelog... Should get used to it by now.
- Added error output in panel which fixes #16
# v0.6 Changelog - 16/Jan/2013
- Changed menu name to "Better Coffeescript"
- Changed menu arguments to be directed to `sublime-better-coffeescript` folders, settings files are still kept as `Coffeescript.sublime-settings`
- Fixed lint errors
- if delay is lower than < 0.5 then we are saying that minimum delay should be 0.5
- added a method that gets the input's filename with .js extension
- setting the output view's name as filename.js fixes #13
- added compileOnSave option fixes #14
- updated readme fixes #6
- added compile output class
- added compile_output command, it displays the console.logs and what not in a panel
- added compile_output command to the context menu (right click). This only works for coffeescripts.
- Added that it existed in README.
- Added option for showOutputOnSave
- Need a way of telling if output is open or closed/hidden #15

View File

@@ -0,0 +1,7 @@
{
"0.5.1": "changelogs/0.5.1.txt",
"0.5.2": "changelogs/0.5.2.txt",
"0.5.3": "changelogs/0.5.3.txt",
"0.5.4": "changelogs/0.5.4.md",
"0.6.0": "changelogs/0.6.md"
}

View File

@@ -0,0 +1,20 @@
{
"schema_version": "1.2",
"packages": [
{
"name": "sublime-better-coffeescript",
"description": "Syntax highlighting and checking, commands, shortcuts, snippets, watched compilation and more.",
"author": "aponxi",
"homepage": "https://github.com/aponxi/sublime-better-coffeescript",
"last_modified": "2013-01-26 20:39:00",
"platforms": {
"*": [
{
"version": "0.6.31",
"url": "https://github.com/aponxi/sublime-better-coffeescript/archive/master.zip"
}
]
}
}
]
}