sublimetext-codeformatter
sublimetext-codeformatter copied to clipboard
Add ability to replace chunks of code
There is a good proverb that I like:
Why write a program that throws lint errors when it can correct the code?
Last night, this idea rattled out of my head and it goes like this; combine the awareness of SublimeLinter with the formatters of CodeFormatter
on_post_save, format code into memory or temporary file- Diff original code against formatted code
- Show gutter warnings and highlight lines that vary based on diff
- Allow user to take action and apply diff to that section of code
Here is a mocked prototype I wrote:

For reference, the code of this prototype is very simple:
import sublime
import sublime_plugin
class ExampleCommand(sublime_plugin.EventListener):
def on_post_save(self, view):
line = view.line(view.sel()[0])
view.add_regions('formmater-suggest',
[line], 'python', 'circle', sublime.DRAW_OUTLINED)
I also ran the following in the terminal for a status message
sublime.status_message('CodeFormatter: Replace code with "view.add_regions(\'formmater-suggest\', [line], \'python\', \'circle\', sublime.DRAW_OUTLINED)"')