mirror of
https://github.com/sstent/sublime-text-3.git
synced 2026-01-25 14:41:38 +00:00
backing up sublime settings
This commit is contained in:
BIN
Packages/User/.SublimeREPLHistory/js.db
Normal file
BIN
Packages/User/.SublimeREPLHistory/js.db
Normal file
Binary file not shown.
BIN
Packages/User/.SublimeREPLHistory/python.db
Normal file
BIN
Packages/User/.SublimeREPLHistory/python.db
Normal file
Binary file not shown.
BIN
Packages/User/.SublimeREPLHistory/shell.db
Normal file
BIN
Packages/User/.SublimeREPLHistory/shell.db
Normal file
Binary file not shown.
427
Packages/User/Monokai (SL).tmTheme
Normal file
427
Packages/User/Monokai (SL).tmTheme
Normal file
@@ -0,0 +1,427 @@
|
||||
<?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>Monokai</string>
|
||||
<key>settings</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#272822</string>
|
||||
<key>caret</key>
|
||||
<string>#F8F8F0</string>
|
||||
<key>foreground</key>
|
||||
<string>#F8F8F2</string>
|
||||
<key>invisibles</key>
|
||||
<string>#3B3A32</string>
|
||||
<key>lineHighlight</key>
|
||||
<string>#3E3D32</string>
|
||||
<key>selection</key>
|
||||
<string>#49483E</string>
|
||||
<key>findHighlight</key>
|
||||
<string>#FFE792</string>
|
||||
<key>findHighlightForeground</key>
|
||||
<string>#000000</string>
|
||||
<key>selectionBorder</key>
|
||||
<string>#222218</string>
|
||||
<key>activeGuide</key>
|
||||
<string>#9D550FB0</string>
|
||||
|
||||
<key>bracketsForeground</key>
|
||||
<string>#F8F8F2A5</string>
|
||||
<key>bracketsOptions</key>
|
||||
<string>underline</string>
|
||||
|
||||
<key>bracketContentsForeground</key>
|
||||
<string>#F8F8F2A5</string>
|
||||
<key>bracketContentsOptions</key>
|
||||
<string>underline</string>
|
||||
|
||||
<key>tagsOptions</key>
|
||||
<string>stippled_underline</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Comment</string>
|
||||
<key>scope</key>
|
||||
<string>comment</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#75715E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>String</string>
|
||||
<key>scope</key>
|
||||
<string>string</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#E6DB74</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Number</string>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#AE81FF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Built-in constant</string>
|
||||
<key>scope</key>
|
||||
<string>constant.language</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#AE81FF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>User-defined constant</string>
|
||||
<key>scope</key>
|
||||
<string>constant.character, constant.other</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#AE81FF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Variable</string>
|
||||
<key>scope</key>
|
||||
<string>variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Keyword</string>
|
||||
<key>scope</key>
|
||||
<string>keyword</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#F92672</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage</string>
|
||||
<key>scope</key>
|
||||
<string>storage</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
<key>foreground</key>
|
||||
<string>#F92672</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Storage type</string>
|
||||
<key>scope</key>
|
||||
<string>storage.type</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#66D9EF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Class name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>underline</string>
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Inherited class</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.inherited-class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic underline</string>
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Function argument</string>
|
||||
<key>scope</key>
|
||||
<string>variable.parameter</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#FD971F</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tag name</string>
|
||||
<key>scope</key>
|
||||
<string>entity.name.tag</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
<key>foreground</key>
|
||||
<string>#F92672</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Tag attribute</string>
|
||||
<key>scope</key>
|
||||
<string>entity.other.attribute-name</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library function</string>
|
||||
<key>scope</key>
|
||||
<string>support.function</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
<key>foreground</key>
|
||||
<string>#66D9EF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library constant</string>
|
||||
<key>scope</key>
|
||||
<string>support.constant</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
<key>foreground</key>
|
||||
<string>#66D9EF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library class/type</string>
|
||||
<key>scope</key>
|
||||
<string>support.type, support.class</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string>italic</string>
|
||||
<key>foreground</key>
|
||||
<string>#66D9EF</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Library variable</string>
|
||||
<key>scope</key>
|
||||
<string>support.other.variable</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Invalid</string>
|
||||
<key>scope</key>
|
||||
<string>invalid</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#F92672</string>
|
||||
<key>fontStyle</key>
|
||||
<string />
|
||||
<key>foreground</key>
|
||||
<string>#F8F8F0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>Invalid deprecated</string>
|
||||
<key>scope</key>
|
||||
<string>invalid.deprecated</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>background</key>
|
||||
<string>#AE81FF</string>
|
||||
<key>foreground</key>
|
||||
<string>#F8F8F0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>JSON String</string>
|
||||
<key>scope</key>
|
||||
<string>meta.structure.dictionary.json string.quoted.double.json</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#CFCFC2</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>diff.header</string>
|
||||
<key>scope</key>
|
||||
<string>meta.diff, meta.diff.header</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#75715E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>diff.deleted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.deleted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#F92672</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>diff.inserted</string>
|
||||
<key>scope</key>
|
||||
<string>markup.inserted</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#A6E22E</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>diff.changed</string>
|
||||
<key>scope</key>
|
||||
<string>markup.changed</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#E6DB74</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
<dict>
|
||||
<key>scope</key>
|
||||
<string>constant.numeric.line-number.find-in-files - match</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#AE81FFA0</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>scope</key>
|
||||
<string>entity.name.filename</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#E6DB74</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
<dict>
|
||||
<key>scope</key>
|
||||
<string>message.error</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#F83333</string>
|
||||
</dict>
|
||||
</dict>
|
||||
|
||||
<dict>
|
||||
<key>name</key>
|
||||
<string>SublimeLinter Error</string>
|
||||
<key>scope</key>
|
||||
<string>sublimelinter.mark.error</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#D02000</string>
|
||||
</dict>
|
||||
</dict><dict>
|
||||
<key>name</key>
|
||||
<string>SublimeLinter Warning</string>
|
||||
<key>scope</key>
|
||||
<string>sublimelinter.mark.warning</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#DDB700</string>
|
||||
</dict>
|
||||
</dict><dict>
|
||||
<key>name</key>
|
||||
<string>SublimeLinter Gutter Mark</string>
|
||||
<key>scope</key>
|
||||
<string>sublimelinter.gutter-mark</string>
|
||||
<key>settings</key>
|
||||
<dict>
|
||||
<key>foreground</key>
|
||||
<string>#FFFFFF</string>
|
||||
</dict>
|
||||
</dict></array>
|
||||
<key>uuid</key>
|
||||
<string>D8D5E82E-3D5B-46B5-B38E-8C841C21347D</string>
|
||||
</dict>
|
||||
</plist>
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"last-modified": "Fri, 28 Mar 2014 15:10:12 GMT",
|
||||
"etag": null
|
||||
}
|
||||
1
Packages/User/Package Control.last-run
Normal file
1
Packages/User/Package Control.last-run
Normal file
@@ -0,0 +1 @@
|
||||
1396018002
|
||||
17
Packages/User/Package Control.sublime-settings
Normal file
17
Packages/User/Package Control.sublime-settings
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"installed_packages":
|
||||
[
|
||||
"Expand Tabs on Save",
|
||||
"GitGutter",
|
||||
"HTMLBeautify",
|
||||
"Jade",
|
||||
"LiveStyle",
|
||||
"sublimelint",
|
||||
"SublimeLinter",
|
||||
"SublimeLinter-contrib-puppet-lint",
|
||||
"SublimeLinter-jshint",
|
||||
"SublimeLinter-json",
|
||||
"SublimeREPL",
|
||||
"TernJS"
|
||||
]
|
||||
}
|
||||
12
Packages/User/Preferences.sublime-settings
Normal file
12
Packages/User/Preferences.sublime-settings
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"color_scheme": "Packages/User/Monokai (SL).tmTheme",
|
||||
"detect_indentation": false,
|
||||
"font_size": 11,
|
||||
"ignored_packages":
|
||||
[
|
||||
"Vintage"
|
||||
],
|
||||
"indent_to_bracket": true,
|
||||
"tab_size": 2,
|
||||
"translate_tabs_to_spaces": true
|
||||
}
|
||||
47
Packages/User/SublimeLinter.sublime-settings
Normal file
47
Packages/User/SublimeLinter.sublime-settings
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"user": {
|
||||
"debug": true,
|
||||
"delay": 0.25,
|
||||
"error_color": "D02000",
|
||||
"gutter_theme": "Packages/SublimeLinter/gutter-themes/Default/Default.gutter-theme",
|
||||
"gutter_theme_excludes": [],
|
||||
"lint_mode": "background",
|
||||
"linters": {
|
||||
"jshint": {
|
||||
"@disable": false,
|
||||
"args": [],
|
||||
"excludes": []
|
||||
},
|
||||
"json": {
|
||||
"@disable": false,
|
||||
"args": [],
|
||||
"excludes": []
|
||||
}
|
||||
},
|
||||
"mark_style": "outline",
|
||||
"no_column_highlights_line": false,
|
||||
"paths": {
|
||||
"linux": [],
|
||||
"osx": [],
|
||||
"windows": []
|
||||
},
|
||||
"python_paths": {
|
||||
"linux": [],
|
||||
"osx": [],
|
||||
"windows": []
|
||||
},
|
||||
"rc_search_limit": 3,
|
||||
"shell_timeout": 10,
|
||||
"show_errors_on_save": true,
|
||||
"show_marks_in_minimap": true,
|
||||
"syntax_map": {
|
||||
"html (django)": "html",
|
||||
"html (rails)": "html",
|
||||
"html 5": "html",
|
||||
"php": "html",
|
||||
"python django": "python"
|
||||
},
|
||||
"warning_color": "DDB700",
|
||||
"wrap_find": true
|
||||
}
|
||||
}
|
||||
1
Packages/User/linters/.version
Normal file
1
Packages/User/linters/.version
Normal file
@@ -0,0 +1 @@
|
||||
c43db55f898ce5b85e891c6c51f5734eabe906db
|
||||
113
Packages/User/linters/applescript.py
Normal file
113
Packages/User/linters/applescript.py
Normal file
@@ -0,0 +1,113 @@
|
||||
from lint import Linter
|
||||
import json
|
||||
import platform
|
||||
import subprocess
|
||||
|
||||
|
||||
def clean_output(args):
|
||||
return '\n'.join([a.decode('utf8') for a in args if a])
|
||||
|
||||
|
||||
def popen(*cmd):
|
||||
p = subprocess.Popen(cmd,
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
)
|
||||
return clean_output(p.communicate())
|
||||
|
||||
|
||||
lint_script = '''
|
||||
import sys
|
||||
from Foundation import NSAppleScript, NSConcreteValue, NSRange
|
||||
import objc
|
||||
import json
|
||||
|
||||
class CustomCodec(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, NSConcreteValue):
|
||||
if obj.objCType() == NSRange.__typestr__:
|
||||
r = obj.rangeValue()
|
||||
return (r.location, r.length)
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
||||
def lint(code):
|
||||
code = code.decode('utf8')
|
||||
linter = NSAppleScript.alloc().initWithSource_(code)
|
||||
errors = dict(linter.compileAndReturnError_(None)[1] or {})
|
||||
objc.recycleAutoreleasePool()
|
||||
return CustomCodec().encode(errors)
|
||||
|
||||
if __name__ == '__main__':
|
||||
code = sys.stdin.read()
|
||||
print lint(code)
|
||||
'''
|
||||
|
||||
|
||||
find_app_script = '''
|
||||
import LaunchServices
|
||||
import sys
|
||||
code, ref, url = LaunchServices.LSFindApplicationForInfo(
|
||||
LaunchServices.kLSUnknownCreator, None, sys.argv[1], None, None)
|
||||
if url:
|
||||
sys.stdout.write(url.path().encode('utf8'))
|
||||
'''
|
||||
|
||||
|
||||
app_name_cache = {}
|
||||
def find_app(name):
|
||||
if not name.endswith('.app'):
|
||||
name += '.app'
|
||||
if not name in app_name_cache:
|
||||
app = popen('/usr/bin/python', '-c', find_app_script, name)
|
||||
app_name_cache[name] = app
|
||||
return app_name_cache[name]
|
||||
|
||||
APP_NAME_SEL = 'string.quoted.double.application-name.applescript'
|
||||
|
||||
|
||||
class AppleScript(Linter):
|
||||
@classmethod
|
||||
def can_lint(cls, language):
|
||||
if platform.system() != 'Darwin':
|
||||
return
|
||||
return 'AppleScript' in language
|
||||
|
||||
def lint(self):
|
||||
tell_apps = [
|
||||
(region, self.view.substr(region).strip('"'))
|
||||
for region in self.view.find_by_selector(APP_NAME_SEL)
|
||||
]
|
||||
any_invalid = False
|
||||
for region, name in tell_apps:
|
||||
if not find_app(name):
|
||||
any_invalid = True
|
||||
start = region.a + 1
|
||||
end = region.b - start - 1
|
||||
line = self.code[:start].count('\n')
|
||||
line_len = len(self.code.split('\n')[line])
|
||||
offset = 0
|
||||
if line:
|
||||
start -= self.code[:start].rindex('\n') + 1
|
||||
|
||||
end = min(line_len - start, end)
|
||||
self.highlight.range(line, start, end)
|
||||
self.error(line, 'Could not find app named {}'.format(name))
|
||||
|
||||
if any_invalid:
|
||||
return
|
||||
|
||||
out = self.communicate(('/usr/bin/python', '-c', lint_script), self.code)
|
||||
out = out.replace('\u2019', '\'')
|
||||
error = json.loads(out)
|
||||
if error:
|
||||
brief = error['NSAppleScriptErrorBriefMessage']
|
||||
# message = error['NSAppleScriptErrorMessage']
|
||||
start, end = error['NSAppleScriptErrorRange']
|
||||
|
||||
line = self.code[:start].count('\n')
|
||||
offset = 0
|
||||
if line:
|
||||
offset = start - self.code[:start].rindex('\n')
|
||||
|
||||
self.highlight.range(line, offset, end - offset)
|
||||
self.error(line, brief)
|
||||
48
Packages/User/linters/c.py
Normal file
48
Packages/User/linters/c.py
Normal file
@@ -0,0 +1,48 @@
|
||||
import os
|
||||
|
||||
from lint import Linter
|
||||
from lint.util import find
|
||||
|
||||
def find_includes(filename):
|
||||
includes = []
|
||||
if filename:
|
||||
parent = os.path.dirname(filename)
|
||||
includes.append('-I' + parent)
|
||||
inc = find(parent, 'include')
|
||||
if inc:
|
||||
includes.append('-I' + inc)
|
||||
|
||||
return includes
|
||||
|
||||
class C(Linter):
|
||||
language = 'c'
|
||||
cmd = ('clang',)
|
||||
args = ('-xc', '-fsyntax-only', '-std=c99', '-Werror', '-pedantic')
|
||||
regex = (
|
||||
r'^<stdin>:(?P<line>\d+):(?P<col>\d+):'
|
||||
r'(?:(?P<ranges>[{}0-9:\-]+):)?\s+'
|
||||
r'(?P<error>.+)'
|
||||
)
|
||||
defaults = {
|
||||
'cmd': cmd,
|
||||
'args': args,
|
||||
'include': [],
|
||||
}
|
||||
|
||||
def run(self, cmd, code):
|
||||
cmd = tuple(self.settings.get('cmd'),) or self.cmd
|
||||
cmd += tuple(self.settings.get('args', []))
|
||||
for include in self.settings.get('include', []):
|
||||
cmd += ('-I{}'.format(include),)
|
||||
cmd += ('-',) + tuple(find_includes(self.filename))
|
||||
return super().communicate(cmd, code)
|
||||
|
||||
class CPP(C):
|
||||
language = 'c++'
|
||||
cmd = ('clang++',)
|
||||
args = ('-xc++', '-fsyntax-only', '-std=c++11', '-Werror', '-pedantic')
|
||||
defaults = {
|
||||
'cmd': cmd,
|
||||
'args': args,
|
||||
'include': [],
|
||||
}
|
||||
6
Packages/User/linters/coffee.py
Normal file
6
Packages/User/linters/coffee.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from lint import Linter
|
||||
|
||||
class Coffee(Linter):
|
||||
language = 'coffeescript'
|
||||
cmd = ('coffee', '--compile', '--stdio')
|
||||
regex = r'^[A-Za-z]+: (?P<error>.+) on line (?P<line>\d+)'
|
||||
13
Packages/User/linters/css.py
Normal file
13
Packages/User/linters/css.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from lint import Linter
|
||||
|
||||
class CSS(Linter):
|
||||
language = 'css'
|
||||
cmd = ('csslint',)
|
||||
regex = (
|
||||
r'^\d+: (?P<type>(error|warning)) at line (?P<line>\d+), col (?P<col>\d+)$\W'
|
||||
r'^(?P<error>.*)$'
|
||||
)
|
||||
multiline = True
|
||||
|
||||
def run(self, cmd, code):
|
||||
return self.tmpfile(cmd, code, suffix='.css')
|
||||
69
Packages/User/linters/eclim.py
Normal file
69
Packages/User/linters/eclim.py
Normal file
@@ -0,0 +1,69 @@
|
||||
import json
|
||||
import os
|
||||
import tempfile
|
||||
|
||||
from lint import Linter
|
||||
from lint.util import find
|
||||
|
||||
class Eclim(Linter):
|
||||
language = 'java'
|
||||
cmd = ('eclim', '-command', 'java_src_update')
|
||||
regex = r'.'
|
||||
|
||||
defaults = {
|
||||
'disable': True,
|
||||
}
|
||||
|
||||
def run(self, cmd, code):
|
||||
project = find(os.path.dirname(self.filename), '.project', True)
|
||||
if not project:
|
||||
return
|
||||
|
||||
filename = self.filename.replace(project, '', 1).lstrip(os.sep)
|
||||
project = os.path.basename(project)
|
||||
|
||||
# can't stdin or temp use file - hack time?
|
||||
# this *could* become a tmp directory
|
||||
# but I'd need to know all files to copy
|
||||
# from the source project
|
||||
tmp = tempfile.mktemp()
|
||||
os.rename(self.filename, tmp)
|
||||
# at least we get some inode protection on posix
|
||||
inode = None
|
||||
|
||||
with open(self.filename, 'wb') as f:
|
||||
f.write(code)
|
||||
if os.name == 'posix':
|
||||
inode = os.stat(self.filename).st_ino
|
||||
|
||||
try:
|
||||
cmd = cmd + ('-p', project, '-f', filename, '-v')
|
||||
output = self.communicate(cmd, '')
|
||||
finally:
|
||||
if inode is not None:
|
||||
new_inode = os.stat(self.filename).st_ino
|
||||
if new_inode != inode:
|
||||
# they saved over our tmp file, bail
|
||||
return output
|
||||
|
||||
os.unlink(self.filename)
|
||||
os.rename(tmp, self.filename)
|
||||
|
||||
return output
|
||||
|
||||
def find_errors(self, output):
|
||||
try:
|
||||
obj = json.loads(output)
|
||||
for item in obj:
|
||||
# TODO: highlight warnings in a different color?
|
||||
# warning = item['warning']
|
||||
line, col = item['line']-1, item['column']-1
|
||||
message = item['message']
|
||||
yield True, line, col, message, None
|
||||
except Exception:
|
||||
error = 'eclim error'
|
||||
if 'Connection refused' in output:
|
||||
error += ' Connection Refused'
|
||||
yield True, 0, None, error, None
|
||||
# maybe do this on line one?
|
||||
# yield {"eclim_exception": str(e)}
|
||||
31
Packages/User/linters/go.py
Normal file
31
Packages/User/linters/go.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import os
|
||||
from lint import Linter
|
||||
|
||||
def find_files(root, ext):
|
||||
root = root.rstrip(os.sep) + os.sep
|
||||
ret = []
|
||||
for base, dirs, names in os.walk(root):
|
||||
for name in names:
|
||||
if name.endswith(ext):
|
||||
base = base.replace(root, '', 1)
|
||||
ret.append(os.path.join(base, name))
|
||||
return ret
|
||||
|
||||
class Golang(Linter):
|
||||
language = 'go'
|
||||
cmd = ('go', 'build', '-gcflags', '-e -N')
|
||||
regex = r'.+?:(?P<line>\d+): (?P<error>.+)'
|
||||
|
||||
def run(self, cmd, code):
|
||||
code = code.encode('utf8')
|
||||
if not self.filename:
|
||||
tools = self.popen(('go', 'tool')).communicate()[0].split('\n')
|
||||
for compiler in ('6g', '8g'):
|
||||
if compiler in tools:
|
||||
return self.tmpfile(('go', 'tool', compiler, '-e', '-o', os.devnull), code, suffix='.go')
|
||||
else:
|
||||
path = os.path.split(self.filename)[0]
|
||||
os.chdir(path)
|
||||
files = find_files(path, '.go')
|
||||
answer = self.tmpdir(cmd, files, code)
|
||||
return answer
|
||||
6
Packages/User/linters/haml.py
Normal file
6
Packages/User/linters/haml.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from lint import Linter
|
||||
|
||||
class HAML(Linter):
|
||||
language = 'ruby haml'
|
||||
cmd = ('haml', '-c')
|
||||
regex = r'^.*line (?P<line>\d+):\s*(?P<error>.+)$'
|
||||
6
Packages/User/linters/html.py
Normal file
6
Packages/User/linters/html.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from lint import Linter
|
||||
|
||||
class HTML(Linter):
|
||||
language = 'html'
|
||||
cmd = ('tidy', '-q', '-e', '-utf8')
|
||||
regex = r'^line (?P<line>\d+) column (?P<col>\d+) - (Warning|Error)?\s*:?\s*(?P<error>.+)$'
|
||||
14
Packages/User/linters/java.py
Normal file
14
Packages/User/linters/java.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from lint import Linter
|
||||
|
||||
class Java(Linter):
|
||||
language = 'java'
|
||||
cmd = ('javac', '-Xlint')
|
||||
regex = r'^[^:]+:(?P<line>\d+): (?P<error>.*)$'
|
||||
|
||||
# this linter doesn't work very well with projects/imports
|
||||
defaults = {
|
||||
'disable': True,
|
||||
}
|
||||
|
||||
def run(self, *args):
|
||||
return self.tmpfile(*args, suffix='.java')
|
||||
10
Packages/User/linters/javascript.py
Normal file
10
Packages/User/linters/javascript.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from lint import Linter
|
||||
|
||||
class JavaScript(Linter):
|
||||
language = 'javascript'
|
||||
cmd = ('jsl', '-stdin')
|
||||
regex = r'^\((?P<line>\d+)\):\s+(?P<error>.+)'
|
||||
|
||||
class EmbeddedJS(JavaScript):
|
||||
language = 'html'
|
||||
selector = 'source.js.embedded.html'
|
||||
9
Packages/User/linters/lua.py
Normal file
9
Packages/User/linters/lua.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from lint import Linter
|
||||
|
||||
class Lua(Linter):
|
||||
language = 'lua'
|
||||
cmd = ('luac', '-p')
|
||||
regex = '^luac: [^:]+:(?P<line>\d+): (?P<error>.+?)(?P<near> near .+)?'
|
||||
|
||||
def run(self, cmd, code):
|
||||
return self.tmpfile(cmd, code, suffix='.lua')
|
||||
10
Packages/User/linters/nasm.py
Normal file
10
Packages/User/linters/nasm.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from lint import Linter
|
||||
import os
|
||||
|
||||
class Nasm(Linter):
|
||||
language = 'x86 assembly'
|
||||
cmd = ('nasm', '-X', 'gnu', '-I.', '-o', os.devnull)
|
||||
regex = r'^[^:]+:(?P<line>\d+): (?P<error>.*)$'
|
||||
|
||||
def run(self, cmd, code):
|
||||
return self.tmpfile(cmd, code, suffix='.asm')
|
||||
6
Packages/User/linters/perl.py
Normal file
6
Packages/User/linters/perl.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from lint import Linter
|
||||
|
||||
class Perl(Linter):
|
||||
language = 'perl'
|
||||
cmd = ('perl', '-c')
|
||||
regex = r'(?P<error>.+?) at .+? line (?P<line>\d+)(, near "(?P<near>.+?)")?'
|
||||
14
Packages/User/linters/php.py
Normal file
14
Packages/User/linters/php.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from lint import Linter
|
||||
|
||||
class PHP(Linter):
|
||||
language = ('php', 'html')
|
||||
cmd = ('php', '-l', '-n', '-d display_errors=On')
|
||||
regex = r'^Parse error:\s*(?P<type>parse|syntax) error,?\s*(?P<error>.+?)?\s+in\s+.+?\s*line\s+(?P<line>\d+)'
|
||||
|
||||
def match_error(self, r, line):
|
||||
match, row, col, error, near = super().match_error(r, line)
|
||||
|
||||
if match and match.group('type') == 'parse' and not error:
|
||||
error = 'parse error'
|
||||
|
||||
return match, row, col, error, near
|
||||
9
Packages/User/linters/puppet.py
Normal file
9
Packages/User/linters/puppet.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from lint import Linter
|
||||
|
||||
class Puppet(Linter):
|
||||
language = 'puppet'
|
||||
cmd = ('puppet', 'parser', 'validate', '--color=false')
|
||||
regex = r'^([^:]+:){2}\s*(?P<error>(Syntax error at|Could not match) \'?(?P<near>[^ ]*?)\'?.*) at [^:]*:(?P<line>\d+)$'
|
||||
|
||||
def run(self, cmd, code):
|
||||
return self.tmpfile(cmd, code, suffix='.puppet')
|
||||
28
Packages/User/linters/python.py
Normal file
28
Packages/User/linters/python.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import sublime
|
||||
import sys
|
||||
|
||||
from lint import Linter
|
||||
from lint.util import which
|
||||
|
||||
class Python(Linter):
|
||||
language = 'python'
|
||||
cmd = 'pyflakes'
|
||||
regex = r'^.+:(?P<line>\d+):\s*(?P<error>.+)'
|
||||
|
||||
def run(self, cmd, code):
|
||||
python3 = False
|
||||
if (self.filename or '').startswith(sublime.packages_path()):
|
||||
if sys.version_info >= (3, 0):
|
||||
python3 = True
|
||||
|
||||
first_line = code.split('\n', 1)[0]
|
||||
if first_line.startswith('#!') and 'python3' in first_line:
|
||||
python3 = True
|
||||
|
||||
if python3 and which('python3'):
|
||||
# python 3
|
||||
pyflakes = which('pyflakes')
|
||||
cmd = ('python3', pyflakes)
|
||||
return self.communicate(cmd, code)
|
||||
else:
|
||||
return self.communicate(cmd, code)
|
||||
6
Packages/User/linters/ruby.py
Normal file
6
Packages/User/linters/ruby.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from lint import Linter
|
||||
|
||||
class Ruby(Linter):
|
||||
language = 'ruby'
|
||||
cmd = ('ruby', '-wc')
|
||||
regex = r'^.+:(?P<line>\d+):\s+(?P<error>.+)'
|
||||
18
Packages/User/linters/todo.py
Normal file
18
Packages/User/linters/todo.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from lint import Linter
|
||||
|
||||
class TODO(Linter):
|
||||
scope = 'string'
|
||||
selector = 'comment'
|
||||
outline = False
|
||||
|
||||
@classmethod
|
||||
def can_lint(cls, language):
|
||||
return True
|
||||
|
||||
def lint(self):
|
||||
lines = self.code.split('\n')
|
||||
for i in range(len(lines)):
|
||||
if 'TODO' in lines[i]:
|
||||
todo = lines[i].index('TODO')
|
||||
self.highlight.range(i, todo, 4)
|
||||
self.error(i, 'TODO')
|
||||
6
Packages/User/linters/xml.py
Normal file
6
Packages/User/linters/xml.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from lint import Linter
|
||||
|
||||
class XML(Linter):
|
||||
language = 'xml'
|
||||
cmd = ('xmllint', '-noout', '-')
|
||||
regex = r'^.+:(?P<line>\d+):\s+(parser error : )?(?P<error>.+)'
|
||||
Reference in New Issue
Block a user