Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add settings.

  • Loading branch information...
commit 4be7738249239c455eac8581d27c60ea8bef3af5 1 parent 97c77e3
@fbzhong authored
View
14 Default.sublime-commands
@@ -6,5 +6,19 @@
{
"caption": "Closure Linter: Show Closure Linter Result",
"command": "show_closure_linter_result"
+ },
+ {
+ "caption": "Preferences: Closure Linter Settings – Default",
+ "command": "open_file", "args":
+ {
+ "file": "${packages}/sublime-closure-linter/sublime-closure-linter.sublime-settings"
+ }
+ },
+ {
+ "caption": "Preferences: Closure Linter Settings – User",
+ "command": "open_file", "args":
+ {
+ "file": "${packages}/User/sublime-closure-linter.sublime-settings"
+ }
}
]
View
35 Main.sublime-menu
@@ -19,5 +19,40 @@
]
}
]
+ },
+ {
+ "id": "preferences",
+ "children":
+ [
+ {
+ "caption": "Package Settings",
+ "id": "package-settings",
+ "children":
+ [
+ {
+ "caption": "Closure Linter",
+ "children":
+ [
+ {
+ "caption": "Settings – Default",
+ "command": "open_file",
+ "args":
+ {
+ "file": "${packages}/sublime-closure-linter/sublime-closure-linter.sublime-settings"
+ }
+ },
+ {
+ "caption": "Settings – User",
+ "command": "open_file",
+ "args":
+ {
+ "file": "${packages}/User/sublime-closure-linter.sublime-settings"
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ]
}
]
View
17 gjslint.py
@@ -6,6 +6,7 @@
from asyncprocess import *
RESULT_VIEW_NAME = 'gjslint_result_view'
+SETTINGS_FILE = "sublime-closure-linter.sublime-settings"
class ShowClosureLinterResultCommand(sublime_plugin.WindowCommand):
"""show closure linter result"""
@@ -14,11 +15,15 @@ def run(self):
class ClosureLinterCommand(sublime_plugin.WindowCommand):
def run(self):
+ s = sublime.load_settings(SETTINGS_FILE)
+
file_path = self.window.active_view().file_name()
file_name = os.path.basename(file_path)
- cmd = '/usr/local/bin/gjslint "' + file_path + '"'
+ cmd = s.get('gjslint_path', 'jslint') + ' ' + s.get('gjslint_flags', '') + ' "' + file_path + '"'
+
+ if s.get('debug', False) == True:
+ print "DEBUG: " + str(cmd)
- print "DEBUG: " + str(cmd)
self.buffered_data = ''
self.file_path = file_path
self.file_name = file_name
@@ -68,7 +73,7 @@ def append_data(self, proc, data, flush=False):
selection_was_at_end = (len(self.output_view.sel()) == 1 and self.output_view.sel()[0] == sublime.Region(self.output_view.size()))
self.output_view.set_read_only(False)
edit = self.output_view.begin_edit()
- self.output_view.insert(edit, self.output_view.size(), str.strip())
+ self.output_view.insert(edit, self.output_view.size(), str)
if selection_was_at_end:
self.output_view.show(self.output_view.size())
self.output_view.end_edit(edit)
@@ -101,7 +106,9 @@ def on_deactivated(self, view):
if view.name() != RESULT_VIEW_NAME:
return
self.previous_resion = None
- self.file_view.erase_regions(RESULT_VIEW_NAME)
+
+ if self.file_view:
+ self.file_view.erase_regions(RESULT_VIEW_NAME)
def on_selection_modified(self, view):
if ClosureLinterEventListener.disabled:
@@ -143,5 +150,3 @@ def on_selection_modified(self, view):
# highlight file_view line
file_view.add_regions(RESULT_VIEW_NAME, [file_region], "string")
-
-
View
10 sublime-closure-linter.sublime-settings
@@ -0,0 +1,10 @@
+{
+ // Path to the gjslint.
+ "gjslint_path": "gjslint",
+
+ // Flags pass to gjslint.
+ "gjslint_flags": "",
+
+ // debug flag.
+ "debug": false
+}
Please sign in to comment.
Something went wrong with that request. Please try again.