Ejemplo n.º 1
0
 def __init__(self, area, *args, **kwargs):
     source      = area.get('1.0', 'end')
     source      = area.get('1.0', 'end')
     line, col   = area.indcur()
     script      = Script(source, line, col, area.filename)
     completions = script.completions()
     CompletionWindow.__init__(self, area, completions, *args, **kwargs)
Ejemplo n.º 2
0
    def __init__(self, area, *args, **kwargs):
        source      = area.get('1.0', 'end')
        line, col   = area.indcur()

        if not self.is_active(): self.run_server()
        completions = self.completions(source, line, col, area.filename)
        CompletionWindow.__init__(self, area, completions, *args, **kwargs)
Ejemplo n.º 3
0
 def __init__(self, area, *args, **kwargs):
     source      = area.get('1.0', 'end')
     source      = area.get('1.0', 'end')
     line, col   = area.indcur()
     script      = Script(source, line, col, area.filename)
     completions = script.completions()
     CompletionWindow.__init__(self, area, completions, *args, **kwargs)
     self.bind('<F1>', lambda event: sys.stdout.write('%s\n%s\n' % ('#' * 80, self.box.selection_docs())))
Ejemplo n.º 4
0
    def __init__(self, area, *args, **kwargs):
        pattern     = area.get(*area.get_seq_range())
        completions = [ind[1][0] for ind in area.find_all(root, '[^ ]*%s[^ ]*' % pattern 
        if pattern else '[^ ]+', nocase=True)]

        completions = set(completions)
        completions = [Option(ind) for ind in completions]

        CompletionWindow.__init__(self, area, 
        completions, *args, **kwargs)
Ejemplo n.º 5
0
    def __init__(self, area,  *args, **kwargs):
        self.area = area
        tmp0      = area.get('1.0', 'insert')
        tmp1      = area.get('insert', 'end')
        source    = tmp0 + tmp1
        offset    = len(tmp0) 

        completions = self.completions(source, offset, area.filename)
        CompletionWindow.__init__(self, area, completions, *args, **kwargs)

        self.bind('<F1>', lambda event: sys.stdout.write('%s\n%s\n' % (
        '#' * 80, self.box.selection_docs())))
Ejemplo n.º 6
0
    def __init__(self, area, *args, **kwargs):
        pattern = area.get_seq()
        completions = map(
            lambda ind: ind[1][0],
            area.find_all(root,
                          '[^ ]*%s[^ ]*' % pattern if pattern else '[^ ]+',
                          nocase=True))

        completions = set(completions)
        completions = map(lambda ind: Option(ind), completions)

        CompletionWindow.__init__(self, area, completions, *args, **kwargs)
Ejemplo n.º 7
0
    def __init__(self, area, *args, **kwargs):
        # If ~/.tern-port doesn't exist then run the server.
        source      = area.get('1.0', 'end')
        line, col   = area.indexref()

        if not exists(join(expanduser('~'), '.tern-port')): 
            self.run_server()

        completions = self.completions(source, line - 1, col, area.filename)
        CompletionWindow.__init__(self, area, completions, *args, **kwargs)
        self.bind('<F1>', lambda event: 
        sys.stdout.write('/*%s*/\n%s\n' % ('*' * 80, 
        self.box.selection_docs())))
Ejemplo n.º 8
0
    def __init__(self, area, server, *args, **kwargs):
        source = area.get('1.0', 'end')
        line, col = area.indexref()

        data = {
            area.filename: {
                'filetypes': [FILETYPES[area.extension]],
                'contents': source
            }
        }

        completions = server.completions(line, col + 1, area.filename, data,
                                         dirname(area.filename))

        CompletionWindow.__init__(self, area, completions, *args, **kwargs)