sublime-fmt
sublime-fmt copied to clipboard
Provide variable for current selection
I was checking your code to see if I could use it to replace my clang-format plugin [1] and found that my plugin also supports formatting just the selection. Or at least passing the current selection to clang-format [2].
Maybe you could provide variables that would expand to selection_start
, selection_end
offsets, and also selection_length
?
(Although, I've just realized while writing this, that we wouldn't want to pass -offset
and -length
when the selection is empty so that could be another thing that would make supporting this tricky...)
[1] https://github.com/rchl/SublimeClangFormat [2] https://github.com/rchl/SublimeClangFormat/blob/9d4f804e82b471928fab0c347ccabefccaf9240c/ClangFormat.py#L128-L132
(Also, I would really want to run formatting on a separate thread so that the UI doesn't block when formatting MB-big files).