예제 #1
0
    def run(self):
        _logger.info('starting ResponseHandler')

        try:
            # Awaiting other threads...
            self.server.ready_barrier.wait()
        except threading.BrokenBarrierError:
            _logger.error('could not start ResponseHandler properly')
            return

        response_maker = ResponseMaker(self.server.responses)

        try:
            for resp in response_maker.make():

                if resp is None:
                    continue
                
                # XXX change stuff here XXX
                if isinstance(resp, notifications.ErrorsNotification):
                    _logger.info('error data received from server')
                    # Make sure the right type is passed to the async
                    # code. `resp` may point to a different object when
                    # the async code finally has a chance to run.
                    after(0, actions.show_errors, notifications.ErrorsNotification(resp.data.copy()))
                    continue

                # elif resp.type == 'server.status':
                #     after(0, sublime.status_message,
                #           'Dart: {}'.format(resp.status.message))
                #     continue

        except Exception as e:
            _logger.error(e)
예제 #2
0
    def generate(self, path=None, template=None):
        assert path and template, 'wrong call'

        try:
            if not os.path.exists(path):
                os.mkdir(path)
        except OSError as e:
            _logger.error(e)
            sublime.status_message('Dart: Error. Check console for details.')
            return

        with pushd(path):
            was_empty_dir = len(glob.glob("*")) == 0
            sdk = SDK()
            self.window.run_command(
                'dart_exec', {
                    'cmd':
                    [sdk.path_to_pub, 'global', 'run', 'stagehand', template],
                    'preamble':
                    "Running stagehand...\n",
                    'working_dir':
                    path,
                })

            if was_empty_dir:
                after(2000, self.create_sublime_project, path)
예제 #3
0
def show_tooltip(content, view=None, location=-1, timeout=0):
    '''
    Shows a tooltip.

    @content
      The tooltip's content (minihtml).

    @view
      The view in which the tooltip should be shown. If `None`, the active view
      will be used if available.

    @location
      Text location at which the tooltip will be shown.

    @timeout
      If greater than 0, the tooltip will be autohidden after @timeout
      milliseconds.
    '''
    if not view:
        try:
            view = sublime.active_window().active_view()
        except AttributeError as e:
            return

    view.show_popup(content, location=location, max_width=500)

    if timeout > 0:
        def hide(current_id):
            global TOOLTIP_ID
            if TOOLTIP_ID == current_id:
                view.hide_popup()

        current_id = next(id_generator)
        after(timeout, lambda: hide(current_id))
예제 #4
0
    def on_activated(self, view):
        if AnalysisServer.ping() and not view.is_loading():
            g_server.add_root(view, view.file_name())

            if is_active(view):
                g_server.send_set_priority_files(view, [view.file_name()])

                if view.is_dirty():
                    g_server.send_add_content(view)
        else:
            # XXX: Retry this a limited amount of times and increase timeout?
            after(250, self.on_activated, view)
예제 #5
0
    def run(self):
        _logger.info('starting ResponseHandler')

        try:
            # Awaiting other threads...
            self.server.ready_barrier.wait()
        except threading.BrokenBarrierError:
            _logger.error('could not start ResponseHandler properly')
            return

        response_maker = ResponseMaker(self.server.responses)

        try:
            for resp in response_maker.make():

                if resp is None:
                    continue

                if isinstance(resp, dict):
                    if resp.get('_internal') == _SIGNAL_STOP:
                        _logger.info('ResponseHandler exiting by internal request.')
                        return
                
                if isinstance(resp, Notification):
                    if isinstance(resp.params, AnalysisErrorsParams):
                        # Make sure the right type is passed to the async
                        # code. `resp` may point to a different object when
                        # the async code finally has a chance to run.
                        after(0, actions.show_errors,
                              AnalysisErrorsParams.from_json(resp.params.to_json().copy())
                              )
                        continue

                    if isinstance(resp.params, AnalysisNavigationParams):
                        after(0, actions.handle_navigation_data,
                              AnalysisNavigationParams.from_json(resp.params.to_json().copy())
                              )
                        continue

                if isinstance(resp, Response):
                    if isinstance(resp.result, ServerGetVersionResult):
                        print('Dart: Analysis Server version:', resp.result.version)
                        continue

        except Exception as e:
            msg = 'error in thread' + self.name + '\n'
            msg += str(e)
            _logger.error(msg)
예제 #6
0
    def run(self):
        _logger.info('starting ResponseHandler')

        try:
            # Awaiting other threads...
            self.server.ready_barrier.wait()
        except threading.BrokenBarrierError:
            _logger.error('could not start ResponseHandler properly')
            return

        response_maker = ResponseMaker(self.server.responses)

        try:
            for resp in response_maker.make():

                if resp is None:
                    continue

                if isinstance(resp, dict):
                    if resp.get('_internal') == _SIGNAL_STOP:
                        _logger.info('ResponseHandler exiting by internal request.')
                        return
                
                if isinstance(resp, Notification):
                    if isinstance(resp.params, AnalysisErrorsParams):
                        # Make sure the right type is passed to the async
                        # code. `resp` may point to a different object when
                        # the async code finally has a chance to run.
                        after(0, actions.show_errors,
                              AnalysisErrorsParams.from_json(resp.params.to_json().copy())
                              )
                        continue

                    if isinstance(resp.params, AnalysisNavigationParams):
                        after(0, actions.handle_navigation_data,
                              AnalysisNavigationParams.from_json(resp.params.to_json().copy())
                              )
                        continue

                if isinstance(resp, Response):
                    if isinstance(resp.result, ServerGetVersionResult):
                        print('Dart: Analysis Server version:', resp.result.version)
                        continue

        except Exception as e:
            msg = 'error in thread' + self.name + '\n'
            msg += str(e)
            _logger.error(msg)
예제 #7
0
    def on_activated(self, view):
        if not is_view_dart_script(view):
            # _logger.debug('on_activated - not a dart file %s',
            #               view.file_name())
            return

        if AnalysisServer.ping() and not view.is_loading():
            g_server.add_root(view.file_name())

            if is_active(view):
                g_server.send_set_priority_files([view.file_name()])

                if view.is_dirty():
                    g_server.send_add_content(view)
        else:
            after(250, self.on_activated, view)
예제 #8
0
    def on_activated(self, view):
        if not is_view_dart_script(view):
            # _logger.debug('on_activated - not a dart file %s',
            #               view.file_name())
            return

        if AnalysisServer.ping():
            g_server.add_root(view.file_name())

            if is_active(view):
                g_server.send_set_priority_files([view.file_name()])

                if view.is_dirty():
                    g_server.send_add_content(view)
        else:
            after(250, self.on_activated, view)
예제 #9
0
    def run(self):
        _logger.info('starting ResponseHandler')

        try:
            # Awaiting other threads...
            self.server.ready_barrier.wait()
        except threading.BrokenBarrierError:
            _logger.error('could not start ResponseHandler properly')
            return

        response_maker = ResponseMaker(self.server.responses)

        try:
            for resp in response_maker.make():

                if resp is None:
                    continue

                if isinstance(resp, dict):
                    if resp.get('_internal') == _SIGNAL_STOP:
                        _logger.info('ResponseHandler exiting by internal request.')
                        return
                
                # XXX change stuff here XXX
                if isinstance(resp, AnalysisErrorsNotification):
                    _logger.info('error data received from server')
                    # Make sure the right type is passed to the async
                    # code. `resp` may point to a different object when
                    # the async code finally has a chance to run.
                    after(0, actions.show_errors,
                          AnalysisErrorsNotification(resp.data.copy())
                          )
                    continue

                if isinstance(resp, ServerGetVersionResponse):
                    print('Dart: Analysis Server version:', resp.version)
                    continue

                # elif resp.type == 'server.status':
                #     after(0, sublime.status_message,
                #           'Dart: {}'.format(resp.status.message))
                #     continue

        except Exception as e:
            msg = 'error in thread' + self.name + '\n'
            msg += str(e)
            _logger.error(msg)
예제 #10
0
    def run(self):
        _logger.info('starting ResponseHandler')

        try:
            # Awaiting other threads...
            self.server.ready_barrier.wait()
        except threading.BrokenBarrierError:
            _logger.error('could not start ResponseHandler properly')
            return

        response_maker = ResponseMaker(self.server.responses)

        try:
            for resp in response_maker.make():

                if resp is None:
                    continue

                if isinstance(resp, dict):
                    if resp.get('_internal') == _SIGNAL_STOP:
                        _logger.info('ResponseHandler exiting by internal request.')
                        return
                
                # XXX change stuff here XXX
                if isinstance(resp, AnalysisErrorsNotification):
                    _logger.info('error data received from server')
                    # Make sure the right type is passed to the async
                    # code. `resp` may point to a different object when
                    # the async code finally has a chance to run.
                    after(0, actions.show_errors,
                          AnalysisErrorsNotification(resp.data.copy())
                          )
                    continue

                if isinstance(resp, ServerGetVersionResponse):
                    print('Dart: Analysis Server version:', resp.version)
                    continue

                # elif resp.type == 'server.status':
                #     after(0, sublime.status_message,
                #           'Dart: {}'.format(resp.status.message))
                #     continue

        except Exception as e:
            msg = 'error in thread' + self.name + '\n'
            msg += str(e)
            _logger.error(msg)
예제 #11
0
    def run_server_app(self, file_name, working_dir, action):
        if action == 'secondary':
            # run with observatory
            # we need to do additional processing in this case, so we don't
            # use the regular .execute() method to manage the subprocess.
            self.panel = OutputPanel('dart.out')
            self.panel.write('=' * 80)
            self.panel.write('\n')
            self.panel.write('Running dart with Observatory.\n')
            self.panel.write('=' * 80)
            self.panel.write('\n')
            self.panel.show()
            DartRunFileCommand.observatory = RunDartWithObservatory(
                                                           file_name,
                                                           cwd=working_dir,
                                                           listener=self)
            DartRunFileCommand.observatory.start()
            def start_dartium():
                d = Dartium()
                port = DartRunFileCommand.observatory.port
                if port is None:
                    _logger.debug('could not capture observatory port')
                    print("Dart: Cannot start Observatory "
                          "because its port couldn't be retrieved")
                    return
                d.start('http://localhost:{}'.format(port))

            after(1000, lambda: start_dartium())
            return

        preamble = '''* Running {0}
* (output starts below the next line)
==============================================================================
'''
        # TODO(guillermooo): improve event args
        self.execute(
            cmd=[SDK().path_to_dart, '--checked', file_name],
            working_dir=working_dir,
            file_regex=r"'file:///(.+)': error: line (\d+) pos (\d+): (.*)$",
            preamble=preamble.format(file_name),
            )
        DartRunFileCommand.is_script_running = True
예제 #12
0
    def run_server_app(self, file_name, working_dir, action):
        if action == 'secondary':
            # run with observatory
            # we need to do additional processing in this case, so we don't
            # use the regular .execute() method to manage the subprocess.
            self.panel = OutputPanel('dart.out')
            self.panel.write('=' * 80)
            self.panel.write('\n')
            self.panel.write('Running dart with Observatory.\n')
            self.panel.write('=' * 80)
            self.panel.write('\n')
            self.panel.show()
            DartRunFileCommand.observatory = RunDartWithObservatory(
                                                           file_name,
                                                           cwd=working_dir,
                                                           listener=self)
            DartRunFileCommand.observatory.start()
            def start_dartium():
                d = Dartium()
                port = DartRunFileCommand.observatory.port
                if port is None:
                    _logger.debug('could not capture observatory port')
                    print("Dart: Cannot start Observatory "
                          "because its port couldn't be retrieved")
                    return
                d.start('http://localhost:{}'.format(port))

            after(1000, lambda: start_dartium())
            return

        preamble = '''* Running {0}
* (output starts below the next line)
==============================================================================
'''
        # TODO(guillermooo): improve event args
        self.execute(
            cmd=[SDK().path_to_dart, '--checked', file_name],
            working_dir=working_dir,
            file_regex=r"'file:///(.+)': error: line (\d+) pos (\d+): (.*)$",
            preamble=preamble.format(file_name),
            )
        DartRunFileCommand.is_script_running = True
예제 #13
0
    def run(self):
        working_directory = os.path.dirname(self.file_name)
        pub_path = join(self.dartsdk_path, 'bin', 'pub')

        if is_windows():
            pub_path += '.bat'

        print('pub get %s' % self.file_name)
        proc = subprocess.Popen([pub_path, 'get'],
                                cwd=working_directory,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.STDOUT,
                                startupinfo=supress_window())

        out, errs = proc.communicate()
        data = out.decode('utf-8')

        if proc.returncode != 0:
            errs = errs.decode('utf-8')
            _logger.error("error running pub: %s\n%s", self.file_name, errs)
            data = 'error running pub: %s\n%s' % (self.file_name, errs)

        after(50, lambda: self.callback(data))
예제 #14
0
    def generate(self, path=None, template=None):
        assert path and template, 'wrong call'

        try:
            if not os.path.exists(path):
                os.mkdir(path)
        except OSError as e:
            _logger.error(e)
            sublime.status_message('Dart: Error. Check console for details.')
            return

        with pushd(path):
            was_empty_dir = len(glob.glob("*")) == 0
            sdk = SDK()
            self.window.run_command('dart_exec', {
                'cmd': [sdk.path_to_pub, 'global', 'run',
                        'stagehand', template],
                'preamble': "Running stagehand...\n",
                'working_dir': path,
                })

            if was_empty_dir:
                after(2000, self.create_sublime_project, path)
예제 #15
0
    def start_default_browser(self, file_name):
        sdk = SDK()

        if not sdk.path_to_default_user_browser:
            _logger.info('no default user browser defined')
            print("Dart: No default user browser defined "
                  "in Dart plugin settings")
            return

        dart_view = DartFile.from_path(file_name)
        url = 'http://localhost:8080'
        if dart_view.url_path:
            url = url + "/" + dart_view.url_path

        # TODO(guillermooo): make GUIProcess wrapper to abstract out some of
        # the stuff below?
        if sublime.platform() == 'osx':
            bin_ = GenericBinary('open', sdk.path_to_default_user_browser)
            after(1000, lambda: bin_.start(args=[url]))
            return

        elif sublime.platform() == 'windows':
            # FIXME(guillermooo): On Windows, Firefox won't work when started
            # from the cmdline only. If it's started first from the shell, it
            # will work here as well.
            path = sdk.path_to_default_user_browser
            bin_ = GenericBinary(path)
            after(
                1000, lambda: bin_.start(
                    args=[url],
                    shell=True,
                    cwd=os.path.dirname(path),
                ))
            return

        path = sdk.path_to_default_user_browser
        bin_ = GenericBinary(path)
        after(
            1000, lambda: bin_.start(
                args=[url],
                shell=True,
                cwd=os.path.dirname(path),
            ))
예제 #16
0
    def start_default_browser(self, file_name):
        sdk = SDK()

        if not sdk.path_to_default_user_browser:
            _logger.info('no default user browser defined')
            print("Dart: No default user browser defined "
                  "in Dart plugin settings")
            return

        dart_view = DartFile.from_path(file_name)
        url = 'http://localhost:8080'
        if dart_view.url_path:
            url = url + "/" + dart_view.url_path

        # TODO(guillermooo): make GUIProcess wrapper to abstract out some of
        # the stuff below?
        if sublime.platform() == 'osx':
            bin_ = GenericBinary('open', sdk.path_to_default_user_browser)
            after(1000, lambda: bin_.start(args=[url]))
            return

        elif sublime.platform() == 'windows':
            # FIXME(guillermooo): On Windows, Firefox won't work when started
            # from the cmdline only. If it's started first from the shell, it
            # will work here as well.
            path = sdk.path_to_default_user_browser
            bin_ = GenericBinary(path)
            after(1000, lambda: bin_.start(
                                   args=[url],
                                   shell=True,
                                   cwd=os.path.dirname(path),
                                   ))
            return

        path = sdk.path_to_default_user_browser
        bin_ = GenericBinary(path)
        after(1000, lambda: bin_.start(
                               args=[url],
                               shell=True,
                               cwd=os.path.dirname(path),
                               ))
예제 #17
0
 def on_data(self, proc, data):
     after(0, functools.partial(self.append_data, proc, data))
예제 #18
0
 def on_finished(self, proc):
     after(0, functools.partial(self.finish, proc))
예제 #19
0
    def run(self):
        _logger.info('starting ResponseHandler')

        try:
            # Awaiting other threads...
            self.server.ready_barrier.wait()
        except threading.BrokenBarrierError:
            _logger.error('could not start ResponseHandler properly')
            return

        response_maker = ResponseMaker(self.server.responses)

        try:
            for resp in response_maker.make():

                if (resp.type == ResponseType.INTERNAL
                        and resp.internal_request == _SIGNAL_STOP):
                    _logger.info(
                        'ResponseHandler is exiting by internal request')
                    return

                elif resp.type == ResponseType.INTERNAL:
                    _logger.debug('got internal response: %s', resp)
                    continue

                if resp.type == ResponseType.RESULT_ID:
                    _logger.debug('changing search id: %s -> %s', resp.id,
                                  resp.result_id)
                    g_editor_context.search_id = resp.result_id
                    if resp.result:
                        _logger.debug(
                            '^********************************************')
                        print("FOUND RESULT", resp.result.to_encoded_pos())
                        _logger.debug(
                            '^********************************************')
                        # g_editor_context.append_search_results([resp.result])
                    continue

                if resp.type == ResponseType.UNKNOWN:
                    _logger.debug('received unknown type of response: %s',
                                  resp)
                    continue

                if resp.type == 'search.results':
                    _logger.info('received search results')
                    # TODO(guillermooo): pass only result id.
                    if g_editor_context.check_token('search', resp.result_id):
                        _logger.debug(
                            '^********************************************')
                        _logger.debug('search results: %s',
                                      resp.search_results.results)
                        _logger.debug(
                            '^********************************************')

                        rrr = [
                            t.to_encoded_pos()
                            for t in list(resp.search_results.results)
                        ]
                        for r in rrr:
                            print("//////////////////////////////////////", r)
                        out = OutputPanel('foo.bar')
                        out.write('\n'.join(rrr))
                        out.show()
                        # g_editor_context.append_search_results(resp.search_results.results)
                    else:
                        _logger.debug('expired token')

                    continue

                if resp.type == ResponseType.ERRORS:
                    _logger.info('error data received from server')
                    # Make sure the right type is passed to the async
                    # code. `resp` may point to a different object when
                    # the async code finally has a chance to run.
                    after(0, actions.show_errors, resp.copy())
                    continue

                elif resp.type == 'server.status':
                    after(0, sublime.status_message,
                          'Dart: {}'.format(resp.status.message))
                    continue

        except Exception as e:
            _logger.debug(e)
            print('Dart: exception while handling response.')
            print('========================================')
            print(e)
            print('========================================')
예제 #20
0
    def run(self):
        _logger.info('starting ResponseHandler')

        response_maker = ResponseMaker(self.server)

        try:
            for resp in response_maker.make():

                if resp is None:
                    continue

                if isinstance(resp, dict):
                    if resp.get('_internal') == _SIGNAL_STOP:
                        _logger.info('ResponseHandler exiting by internal request.')
                        return

                if isinstance(resp, Notification):
                    if isinstance(resp.params, AnalysisErrorsParams):
                        # Make sure the right type is passed to the async
                        # code. `resp` may point to a different object when
                        # the async code finally has a chance to run.
                        after(0, actions.show_errors,
                              AnalysisErrorsParams.from_json(resp.params.to_json().copy())
                              )
                        continue

                    if isinstance(resp.params, AnalysisNavigationParams):
                        after(0, actions.handle_navigation_data,
                              AnalysisNavigationParams.from_json(resp.params.to_json().copy())
                              )
                        continue

                    if isinstance(resp.params, CompletionResultsParams):
                        with editor_context.autocomplete_context as actx:
                            if actx.request_id or (resp.params.id != actx.id):
                                actx.invalidate_results()
                                continue
                        after(0, actions.handle_completions,
                              CompletionResultsParams.from_json(resp.params.to_json().copy())
                              )

                if isinstance(resp, Response):
                    if isinstance(resp.result, ServerGetVersionResult):
                        print('Dart: Running analysis server version', resp.result.version)
                        continue

                    if isinstance(resp.result, CompletionGetSuggestionsResult):
                        with editor_context.autocomplete_context as actx:
                            if resp.id != actx.request_id:
                                continue

                            actx.id = resp.result.id
                            actx.request_id = None

                    if isinstance(resp.result, EditFormatResult):
                        after(0, actions.handle_formatting, EditFormatResult.from_json(resp.result.to_json().copy()))
                        continue

        except Exception as e:
            msg = 'error in thread' + self.name + '\n'
            msg += str(e)
            _logger.error(msg)
예제 #21
0
 def on_finished(self, proc):
     after(0, functools.partial(self.finish, proc))
예제 #22
0
 def on_data(self, proc, data):
     after(0, functools.partial(self.append_data, proc, data))
예제 #23
0
    def run(self):
        _logger.info('starting ResponseHandler')

        response_maker = ResponseMaker(self.server)

        try:
            for resp in response_maker.make():

                if resp is None:
                    continue

                if isinstance(resp, dict):
                    if resp.get('_internal') == _SIGNAL_STOP:
                        _logger.info(
                            'ResponseHandler exiting by internal request.')
                        return

                if isinstance(resp, Notification):
                    if isinstance(resp.params, AnalysisErrorsParams):
                        # Make sure the right type is passed to the async
                        # code. `resp` may point to a different object when
                        # the async code finally has a chance to run.
                        after(
                            0, actions.show_errors,
                            AnalysisErrorsParams.from_json(
                                resp.params.to_json().copy()))
                        continue

                    if isinstance(resp.params, AnalysisNavigationParams):
                        after(
                            0, actions.handle_navigation_data,
                            AnalysisNavigationParams.from_json(
                                resp.params.to_json().copy()))
                        continue

                    if isinstance(resp.params, CompletionResultsParams):
                        with editor_context.autocomplete_context as actx:
                            if actx.request_id or (resp.params.id != actx.id):
                                actx.invalidate_results()
                                continue
                        after(
                            0, actions.handle_completions,
                            CompletionResultsParams.from_json(
                                resp.params.to_json().copy()))

                if isinstance(resp, Response):
                    if isinstance(resp.result, ServerGetVersionResult):
                        print('Dart: Running analysis server version',
                              resp.result.version)
                        continue

                    if isinstance(resp.result, CompletionGetSuggestionsResult):
                        with editor_context.autocomplete_context as actx:
                            if resp.id != actx.request_id:
                                continue

                            actx.id = resp.result.id
                            actx.request_id = None

                    if isinstance(resp.result, EditFormatResult):
                        after(
                            0, actions.handle_formatting,
                            EditFormatResult.from_json(
                                resp.result.to_json().copy()))
                        continue

        except Exception as e:
            msg = 'error in thread' + self.name + '\n'
            msg += str(e)
            _logger.error(msg)
예제 #24
0
    def run(self):
        _logger.info('starting ResponseHandler')

        try:
            # Awaiting other threads...
            self.server.ready_barrier.wait()
        except threading.BrokenBarrierError:
            _logger.error('could not start ResponseHandler properly')
            return

        response_maker = ResponseMaker(self.server.responses)

        try:
            for resp in response_maker.make():

                if (resp.type == ResponseType.INTERNAL and
                    resp.internal_request == _SIGNAL_STOP):
                        _logger.info(
                            'ResponseHandler is exiting by internal request')
                        return

                elif resp.type == ResponseType.INTERNAL:
                    _logger.debug('got internal response: %s', resp)
                    continue

                if resp.type == ResponseType.RESULT_ID:
                    _logger.debug('changing search id: %s -> %s', resp.id, resp.result_id)
                    g_editor_context.search_id = resp.result_id
                    if resp.result:
                        _logger.debug('^********************************************')
                        print("FOUND RESULT", resp.result.to_encoded_pos())
                        _logger.debug('^********************************************')
                        # g_editor_context.append_search_results([resp.result])
                    continue

                if resp.type == ResponseType.UNKNOWN:
                    _logger.debug('received unknown type of response: %s', resp)
                    continue

                if resp.type == 'search.results':
                    _logger.info('received search results')
                    # TODO(guillermooo): pass only result id.
                    if g_editor_context.check_token('search', resp.result_id):
                        _logger.debug('^********************************************')
                        _logger.debug('search results: %s', resp.search_results.results)
                        _logger.debug('^********************************************')

                        rrr = [t.to_encoded_pos() for t in list(resp.search_results.results)]
                        for r in rrr:
                            print("//////////////////////////////////////", r)
                        out = OutputPanel('foo.bar')
                        out.write('\n'.join(rrr))
                        out.show()
                        # g_editor_context.append_search_results(resp.search_results.results)
                    else:
                        _logger.debug('expired token')

                    continue

                if resp.type == ResponseType.ERRORS:
                    _logger.info('error data received from server')
                    # Make sure the right type is passed to the async
                    # code. `resp` may point to a different object when
                    # the async code finally has a chance to run.
                    after(0, actions.show_errors, resp.copy())
                    continue

                elif resp.type == 'server.status':
                    after(0, sublime.status_message,
                          'Dart: {}'.format(resp.status.message))
                    continue

        except Exception as e:
            _logger.debug(e)
            print('Dart: exception while handling response.')
            print('========================================')
            print(e)
            print('========================================')