/
imba_commands.py
33 lines (27 loc) · 1.15 KB
/
imba_commands.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
import sublime, sublime_plugin
import re
# Extends TextCommand so that run() receives a View to modify.
class ImbaCommaCommand(sublime_plugin.TextCommand):
def run(self, edit, args = None):
loc = self.view.sel()[0]
if self.view.match_selector(loc.a,"scope.property.imba"):
self.view.run_command("insert",{"characters": ", "})
self.view.run_command("auto_complete", {'disable_auto_insert': True,'next_completion_if_showing': False})
self.view.end_edit(edit)
else:
pass
class ImbaDeleteTagCommand(sublime_plugin.TextCommand):
def run(self, edit, args = None):
print('running delete command')
self.view.run_command("right_delete")
self.view.run_command("left_delete")
self.view.run_command("hide_auto_complete")
class ImbaWrapTag(sublime_plugin.TextCommand):
def run(self, edit, args = None):
self.view.run_command("right_delete")
self.view.run_command("left_delete")
self.view.run_command("hide_auto_complete")
class ImbaOpenTag(sublime_plugin.TextCommand):
def run(self, edit, args = None):
self.view.run_command("insert_snippet",{"contents": "<${1:$SELECTION}>"})
# self.view.run_command("hide_auto_complete")