Golang Build: add support for Sublime Text build navigation
Allows for using the Tools > Build Results > (Next|Previous)
Result menu entries or keyboard bindings to jump to files
containing build errors. Also supports cmd/ctrl clicking file
names in error messages.
Change-Id: I55762e53e74308b02086835d17f66259acc84e2b
Reviewed-on: https://go-review.googlesource.com/16153
Reviewed-by: Jason Buberel <jbuberel@google.com>
diff --git a/golang_build.py b/golang_build.py
index b44c428..e0a32a7 100644
--- a/golang_build.py
+++ b/golang_build.py
@@ -709,6 +709,7 @@
"""
self.panel.printer_lock.acquire()
+ self.panel.set_base_dir(self.proc.cwd)
try:
self._write_header()
@@ -845,6 +846,7 @@
panel_settings = self.panel.settings()
panel_settings.set('syntax', 'Packages/Golang Build/Golang Build Output.tmLanguage')
panel_settings.set('color_scheme', st_settings.get('color_scheme'))
+ panel_settings.set('result_file_regex', '^(.+\.go):([0-9]+):(?:([0-9]+):)?\s*(.*)')
panel_settings.set('draw_white_space', 'selection')
panel_settings.set('word_wrap', False)
panel_settings.set("auto_indent", False)
@@ -852,6 +854,19 @@
panel_settings.set('gutter', False)
panel_settings.set('scroll_past_end', False)
+ def set_base_dir(self, cwd):
+ """
+ Set the directory the process is being run in, for the sake of result
+ navigation
+
+ :param cwd:
+ A unicode string of the working directory
+ """
+
+ def _update_settings():
+ self.panel.settings().set('result_base_dir', cwd)
+ sublime.set_timeout(_update_settings, 1)
+
def write(self, string, content_separator=None, event=None):
"""
Queues data to be written to the output panel. Normally this will be