-
Notifications
You must be signed in to change notification settings - Fork 8
/
IndentX.py
84 lines (62 loc) · 2.26 KB
/
IndentX.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This file is part of IndentX.
# https://github.com/socsieng/IndentX
# Licensed under the MIT license:
# http://www.opensource.org/licenses/MIT-license
# Copyright (c) 2015, Socheat Sieng <socsieng@gmail.com>
import os
import sys
import sublime
import sublime_plugin
import imp
sys.path.append(os.path.dirname(os.path.realpath(__file__)))
reloader_name = 'indent_x.package_util.reloader'
try:
if reloader_name in sys.modules:
imp.reload(sys.modules[reloader_name])
else:
import indent_x.package_util.reloader
except:
pass
from indent_x import commands
class BasicIndentCommand(sublime_plugin.TextCommand):
def __init__(self, view):
sublime_plugin.TextCommand.__init__(self, view)
self.command = commands.IndentCommand(self.view, sublime)
def is_enabled(self):
return self.command.is_enabled()
def run(self, edit):
self.command.run(edit)
class JsonIndentFormatCommand(sublime_plugin.TextCommand):
def __init__(self, view):
sublime_plugin.TextCommand.__init__(self, view)
self.command = commands.FormatJsonCommand(self.view, sublime)
def is_enabled(self):
return self.command.is_enabled()
def run(self, edit):
self.command.run(edit)
class JsonToYamlCommand(sublime_plugin.TextCommand):
def __init__(self, view):
sublime_plugin.TextCommand.__init__(self, view)
self.command = commands.FormatYamlCommand(self.view, sublime)
def is_enabled(self):
return self.command.is_enabled()
def run(self, edit):
self.command.run(edit)
class BasicUnindentCommand(sublime_plugin.TextCommand):
def __init__(self, view):
sublime_plugin.TextCommand.__init__(self, view)
self.command = commands.UnindentCommand(self.view, sublime)
def is_enabled(self):
return self.command.is_enabled()
def run(self, edit):
self.command.run(edit)
class ReportIssueCommand(sublime_plugin.TextCommand):
def __init__(self, view):
sublime_plugin.TextCommand.__init__(self, view)
self.command = commands.ReportIssueCommand(self.view, os, sys)
def is_enabled(self):
return self.command.is_enabled()
def run(self, edit):
self.command.run(edit)