def show_types(self, types): if not types: show_status_message("Can't infer type", False) return types = sorted(list( filter(lambda t: t.region(self.view).contains(self.view.sel()[0]), types)), key=lambda t: t.region(self.view).size()) self.output_view = output_panel(self.view.window(), '', panel_name=TYPES_PANEL_NAME, syntax='Haskell-SublimeHaskell', show_panel=False) regions = [] for t in types: output_text(self.output_view, '{0}\n'.format(t.show(self.view)), clear=False) regions.append( sublime.Region( self.output_view.size() - 1 - len(use_unicode_operators(t.typename)), self.output_view.size() - 1)) self.output_view.add_regions('types', regions, 'comment', '', sublime.DRAW_OUTLINED) show_panel(self.view.window(), panel_name=TYPES_PANEL_NAME)
def show_types(self, types): if not types: show_status_message("Can't infer type", False) return self.types = types self.output_view = output_panel(self.view.window(), '', panel_name = 'sublime_haskell_show_type', syntax = 'Haskell-SublimeHaskell') self.view.window().show_quick_panel([t.typename for t in self.types], self.on_done, 0, -1, self.on_changed)
def show_types(self, types): if not types: show_status_message("Can't infer type", False) return self.types = types self.output_view = output_panel(self.view.window(), '', panel_name = 'sublime_haskell_show_types', syntax = 'Haskell-SublimeHaskell', show_panel = False) regions = [] for t in self.types: output_text(self.output_view, '{0}\n'.format(t.show(self.view)), clear = False) regions.append(sublime.Region(self.output_view.size() - 1 - len(t.typename), self.output_view.size() - 1)) self.output_view.add_regions('types', regions, 'comment', '', sublime.DRAW_OUTLINED) show_panel(self.view.window(), panel_name = 'sublime_haskell_show_type')
def show_types(self, types): if not types: show_status_message("Can't infer type", False) return self.types = types self.output_view = output_panel(self.view.window(), '', panel_name=TYPES_PANEL_NAME, syntax='Haskell-SublimeHaskell') self.view.window().show_quick_panel([t.typename for t in self.types], self.on_done, 0, -1, self.on_changed)
def run(self, edit): selections = list(self.view.sel()) if not self.is_infos_valid(selections): self.Infos = [ExpandSelectionInfo(self.view, s) for s in selections] if not self.is_infos_valid(selections): show_status_message('Unable to retrieve expand selection info', False) return tr = [i.expand() for i in self.Infos] self.view.sel().clear() self.view.sel().add_all([t.region for t in tr]) output_panel(self.view.window(), '\n'.join([t.typename for t in tr]), panel_name = 'sublime_haskell_expand_selection_expression', syntax = 'Haskell-SublimeHaskell')
def show_types(self, types): if not types: show_status_message("Can't infer type", False) return types = sorted( list(filter(lambda t: t.region(self.view).contains(self.view.sel()[0]), types)), key = lambda t: t.region(self.view).size()) self.output_view = output_panel(self.view.window(), '', panel_name = TYPES_PANEL_NAME, syntax = 'Haskell-SublimeHaskell', show_panel = False) regions = [] for t in types: output_text(self.output_view, '{0}\n'.format(t.show(self.view)), clear = False) regions.append(sublime.Region(self.output_view.size() - 1 - len(t.typename), self.output_view.size() - 1)) self.output_view.add_regions('types', regions, 'comment', '', sublime.DRAW_OUTLINED) show_panel(self.view.window(), panel_name = TYPES_PANEL_NAME)
def show_types(self, types): if not types: show_status_message("Can't infer type", False) return best_result = self.get_best_type(types) type_text = [best_result.show(self.view), ''] type_text.extend([r.show(self.view) for r in types if r.start.line == r.end.line]) output_view = self.view.window().get_output_panel('sublime_haskell_hdevtools_type') output_view.set_read_only(False) output_view.run_command('sublime_haskell_output_text', { 'text': '\n'.join(type_text) }) output_view.sel().clear() output_view.set_read_only(True) self.view.window().run_command('show_panel', { 'panel': 'output.sublime_haskell_hdevtools_type' })
def run(self, edit): selections = list(self.view.sel()) if not self.is_infos_valid(selections): self.Infos = [ ExpandSelectionInfo(self.view, s) for s in selections ] if not self.is_infos_valid(selections): show_status_message('Unable to retrieve expand selection info', False) return tr = [i.expand() for i in self.Infos] self.view.sel().clear() self.view.sel().add_all([t.region for t in tr]) output_panel(self.view.window(), '\n'.join([t.typename for t in tr]), panel_name='sublime_haskell_expand_selection_expression', syntax='Haskell-SublimeHaskell')
def show_types(self, types): if not types: show_status_message("Can't infer type", False) return best_result = self.get_best_type(types) type_text = [best_result.show(self.view), ''] type_text.extend( [r.show(self.view) for r in types if r.start.line == r.end.line]) output_view = self.view.window().get_output_panel( 'sublime_haskell_hdevtools_type') output_view.set_read_only(False) output_view.run_command('sublime_haskell_output_text', {'text': '\n'.join(type_text)}) output_view.sel().clear() output_view.set_read_only(True) self.view.window().run_command( 'show_panel', {'panel': 'output.sublime_haskell_hdevtools_type'})
def show_types(self, types): if not types: show_status_message("Can't infer type", False) return self.types = types self.output_view = output_panel( self.view.window(), '', panel_name='sublime_haskell_show_types', syntax='Haskell-SublimeHaskell', show_panel=False) regions = [] for t in self.types: output_text(self.output_view, '{0}\n'.format(t.show(self.view)), clear=False) regions.append( sublime.Region(self.output_view.size() - 1 - len(t.typename), self.output_view.size() - 1)) self.output_view.add_regions('types', regions, 'comment', '', sublime.DRAW_OUTLINED) show_panel(self.view.window(), panel_name='sublime_haskell_show_type')