-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added format on save feature. #11
Conversation
@Flet Are you aware of any ways to detect active syntax through Sublime Linter itself? Right now, I have to check if the file is javascript every PS Super clean job on auto-format selection! |
SL, for some reason, overwites |
Hmm, yeah. in I see this in persist.py def get_syntax(view):
"""Return the view's syntax or the syntax it is mapped to in the "syntax_map" setting."""
view_syntax = view.settings().get('syntax', '')
mapped_syntax = ''
if view_syntax:
match = SYNTAX_RE.search(view_syntax)
if match:
view_syntax = match.group(1).lower()
mapped_syntax = settings.get('syntax_map', {}).get(view_syntax, '').lower()
else:
view_syntax = ''
return mapped_syntax or view_syntax So, could use that call or define our own by calling |
re: settings, yeah I tihnk it would just be another exposed setting in the Rabbit hole is here I believe: http://www.sublimelinter.com/en/latest/settings.html#inline-settings |
Ah, I think its inline_overrides and defauts stuff. may be cool to check out flake8 to see how they do it too. Now the question is how can these be read by formatter.py :) |
Toggle switch is in the command palate and in the package settings menu.
Ok, this is almost ready to go. I'm a bit unhappy with the outcome:
SublimeLinter provides a great API for linters and a handy What do you think about putting the formatting efforts into its own plugin like I started here? https://github.com/bcomnes/sublime-standard-format |
Indeed, I agree it feels like trying to do too much, especially since this is built off of a very structured template provided by SublimeLinter. I think I owe you some asprin for banging your head against the wall on this stuff today 😬 All your points are completely valid. I'm absolutely fine with splitting formatting out of this plugin. Once Thanks for digging on this :) |
No headache! Its a good way to learn about Sublime Plugins, something I've wanted to look into for a while. Added you as a contributor to https://github.com/bcomnes/sublime-standard-format |
👍 |
Please don't merge yet. A few questions:
is_javascript()
function.subprocess
andstandard-format
. I'm not sure what the culprit is yet. (see https://github.com/bcomnes/sublime-standard-format/blob/master/standard-format.py#L44)Other things todo here: