Skip to content

Commit 7f35e24

Browse files
committed
Implements the ignore-selection option
1 parent 1987997 commit 7f35e24

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ git clone https://github.com/ionutvmi/sublime-jsfmt jsfmt
7272
},
7373
"alert-errors": true,
7474
// path to nodejs
75-
"node-path": "node"
75+
"node-path": "node",
76+
// if true it will format the whole file even if you have a selection active
77+
"ignore-selection": false
7678
}
7779

7880
```

jsfmt-sublime.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def plugin_loaded():
2626

2727
class FormatJavascriptCommand(sublime_plugin.TextCommand):
2828
def run(self, edit):
29-
if not self.has_selection():
29+
if not self.has_selection() or settings.get('ignore-selection', False):
3030
region = sublime.Region(0, self.view.size())
3131
originalBuffer = self.view.substr(region)
3232
formated = self.jsfmt(originalBuffer, self.get_scope(region))

jsfmt.sublime-settings

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@
2828
}
2929
},
3030
"node-path": "node",
31-
"alert-errors": true
31+
"alert-errors": true,
32+
"ignore-selection": false
3233
}

0 commit comments

Comments
 (0)