Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def on_changed(self, idx):
        if idx == -1:
            return

        t = self.types[idx]
        output_text(self.output_view, t.show(self.view), clear = True)
        self.view.add_regions('typed', [t.region(self.view)], 'string', 'dot', sublime.DRAW_OUTLINED)
Exemplo n.º 3
0
    def on_done(self, idx):
        self.view.erase_regions('typed')

        if idx == -1:
            return

        t = self.types[idx]
        output_text(self.output_view, t.show(self.view), clear = True)
Exemplo n.º 4
0
    def on_changed(self, idx):
        if idx == -1:
            return

        t = self.types[idx]
        output_text(self.output_view, t.show(self.view), clear=True)
        self.view.add_regions('typed', [t.region(self.view)], 'string', 'dot',
                              sublime.DRAW_OUTLINED)
Exemplo n.º 5
0
    def on_done(self, idx):
        self.view.erase_regions('typed')

        if idx == -1:
            return

        t = self.types[idx]
        output_text(self.output_view, t.show(self.view), clear=True)
Exemplo n.º 6
0
    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')
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    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')