forked from DisposaBoy/GoSublime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgscommands.py
26 lines (22 loc) · 920 Bytes
/
gscommands.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
import sublime, sublime_plugin
import gscommon as gs
class GsCommentForwardCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.run_command("toggle_comment", {"block": False})
self.view.run_command("move", {"by": "lines", "forward": True})
class GsFmtSaveCommand(sublime_plugin.TextCommand):
def run(self, edit):
if gs.is_go_source_view(self.view):
self.view.run_command("gs_fmt")
sublime.set_timeout(lambda: self.view.run_command("save"), 0)
class GsFmtPromptSaveAsCommand(sublime_plugin.TextCommand):
def run(self, edit):
if gs.is_go_source_view(self.view):
self.view.run_command("gs_fmt")
sublime.set_timeout(lambda: self.view.run_command("prompt_save_as"), 0)
class GsGotoRowColCommand(sublime_plugin.TextCommand):
def run(self, edit, row, col=0):
pt = self.view.text_point(row, col)
self.view.sel().clear()
self.view.sel().add(sublime.Region(pt))
self.view.show(pt)