示例#1
0
    def run(self) -> None:
        try:
            view = self.window.active_view()
            self.view = view
            scope = get_settings(view, 'anaconda_go_guru_scope')
            row, col = view.rowcol(view.sel()[0].begin())
            offset = view.text_point(row, col)
            code = view.substr(sublime.Region(0, view.size()))

            data = {
                'vid': view.id(),
                'scope': scope if scope is not None else get_scope(view, go.GOPATH),  # noqa
                'path': view.file_name(),
                'offset': offset,
                'modified_buffer': self._modified_buffer(view, code),
                'go_env': {
                    'GOROOT': go.GOROOT,
                    'GOPATH': go.GOPATH,
                    'CGO_ENABLED': go.CGO_ENABLED
                },
                'method': 'implements',
                'handler': 'anaGonda'
            }
            Worker().execute(
                Callback(
                    on_success=self._on_success,
                    on_failure=self._on_failure,
                    on_timeout=self._on_timeout
                ), **data
            )
        except:
            print('anaconda_go: implements error')
            print(traceback.print_exc())
示例#2
0
    def run(self, edit: sublime.Edit) -> None:
        try:
            view = self.view
            scope = get_settings(view, 'anaconda_go_guru_scope')
            row, col = view.rowcol(view.sel()[0].begin())
            offset = view.text_point(row, col)
            code = view.substr(sublime.Region(0, view.size()))

            data = {
                'vid': view.id(),
                'scope': scope if scope is not None else get_scope(view, go.GOPATH),  # noqa
                'path': view.file_name(),
                'offset': offset,
                'modified_buffer': self._modified_buffer(view, code),
                'go_env': {
                    'GOROOT': go.GOROOT,
                    'GOPATH': go.GOPATH,
                    'CGO_ENABLED': go.CGO_ENABLED
                },
                'method': 'callstack',
                'handler': 'anaGonda'
            }
            Worker().execute(
                Callback(
                    on_success=self._on_success,
                    on_failure=self._on_failure,
                    on_timeout=self._on_timeout
                ),
                **data
            )
        except:
            print('anaconda_go: callers error')
            print(traceback.print_exc())
示例#3
0
 def run(self, operation='analyze') -> None:
     self.operation = operation
     try:
         view = self.window.active_view()
         self.view = view
         scope = get_settings(view, 'anaconda_go_guru_scope')
         data = {
             'vid': self.view.id(),
             'scope': scope if scope is not None else get_scope(
                 view, go.GOPATH),  # noqa
             'code': view.substr(sublime.Region(0, view.size())),
             'offset': view.text_point(*view.rowcol(view.sel()[0].begin())),
             'path': view.file_name(),
             'buf': self.modified_buffer(view),
             'mode': self.operation,
             'go_env': {
                 'GOROOT': go.GOROOT,
                 'GOPATH': go.GOPATH,
                 'CGO_ENABLED': go.CGO_ENABLED
             },
             'method': 'analyze_symbol',
             'handler': 'anaGonda'
         }
         Worker().execute(
             Callback(on_success=self.on_success,
                      on_failure=self._on_failure,
                      on_timeout=self._on_timeout), **data)
     except Exception as err:
         print('anaconda_go: {}'.format(self.method.replace('_', '')))
         print(err)
示例#4
0
 def run(self) -> None:
     try:
         view = self.window.active_view()
         self.view = view
         scope = get_settings(view, 'anaconda_go_guru_scope')
         data = {
             'vid': view.id(),
             'scope': scope if scope is not None else get_scope(
                 view, go.GOPATH),  # noqa
             'code': view.substr(sublime.Region(0, view.size())),
             'path': view.file_name(),
             'buf': self.modified_buffer(view),
             'go_env': {
                 'GOROOT': go.GOROOT,
                 'GOPATH': go.GOPATH,
                 'CGO_ENABLED': go.CGO_ENABLED
             },
             'method': 'get_package_decls',
             'handler': 'anaGonda'
         }
         Worker().execute(
             Callback(on_success=ExplorerPanel(view).run,
                      on_failure=self._on_failure,
                      on_timeout=self._on_timeout), **data)
     except Exception as err:
         print('anaconda_go: {}'.format(self.method.replace('_', ' ')))
         print(err)
示例#5
0
 def run(self, operation='analyze') -> None:
     self.operation = operation
     try:
         view = self.window.active_view()
         self.view = view
         scope = get_settings(view, 'anaconda_go_guru_scope')
         data = {
             'vid': self.view.id(),
             'scope': scope if scope is not None else get_scope(view, go.GOPATH),  # noqa
             'code': view.substr(sublime.Region(0, view.size())),
             'offset': view.text_point(*view.rowcol(view.sel()[0].begin())),
             'path': view.file_name(),
             'buf': self.modified_buffer(view),
             'mode': self.operation,
             'go_env': {
                 'GOROOT': go.GOROOT,
                 'GOPATH': go.GOPATH,
                 'CGO_ENABLED': go.CGO_ENABLED
             },
             'method': 'analyze_symbol',
             'handler': 'anaGonda'
         }
         Worker().execute(
             Callback(
                 on_success=self.on_success,
                 on_failure=self._on_failure,
                 on_timeout=self._on_timeout
             ),
             **data
         )
     except Exception as err:
         print('anaconda_go: {}'.format(self.method.replace('_', '')))
         print(err)
示例#6
0
 def run(self) -> None:
     try:
         view = self.window.active_view()
         self.view = view
         scope = get_settings(view, 'anaconda_go_guru_scope')
         data = {
             'vid': view.id(),
             'scope': scope if scope is not None else get_scope(view, go.GOPATH),  # noqa
             'code': view.substr(sublime.Region(0, view.size())),
             'path': view.file_name(),
             'buf': self.modified_buffer(view),
             'go_env': {
                 'GOROOT': go.GOROOT,
                 'GOPATH': go.GOPATH,
                 'CGO_ENABLED': go.CGO_ENABLED
             },
             'method': 'get_package_decls',
             'handler': 'anaGonda'
         }
         Worker().execute(
             Callback(
                 on_success=ExplorerPanel(view).run,
                 on_failure=self._on_failure,
                 on_timeout=self._on_timeout
             ),
             **data
         )
     except Exception as err:
         print('anaconda_go: {}'.format(self.method.replace('_', ' ')))
         print(err)