Beispiel #1
0
    def completions(self,
                    line,
                    col,
                    path,
                    data,
                    dir,
                    target=None,
                    cmdargs=None):

        data = {
            'line_num': line,
            'column_num': col,
            'filepath': path,
            'file_data': data
        }

        url = '%s/completions' % self.url

        hmac_secret = self.hmac_req('POST', '/completions', data,
                                    self.hmac_secret)

        headers = {
            'X-YCM-HMAC': hmac_secret,
        }

        req = self.post(url, json=data, headers=headers, timeout=2)
        printd('Request data:', req.json())
        return self.build_docs(req.json())
Beispiel #2
0
    def set_path(self, event):
        """    
        Set the project root automatically.
        """

        self.area.project = get_sentinel_file(self.area.filename,
                                              *Project.sentinels)
        printd('Project - Setting project path = ', self.area.project)
Beispiel #3
0
 def c_path(cls, path='ag'):
     """
     Set the ag path. If ag is known to your environment then
     there is no need to set it.
     """
     pass
     cls.path = path
     printd('Sniper - Setting ag path = ', path)
Beispiel #4
0
    def ready(self, line, col, path, data):
        """
        Send file ready.
        """

        req = self.e_send('FileReadyToParse', line, col, path, data)
        printd('Ycmd - /FileReadyToParse status', req.status_code)
        printd('Ycmd - FileReadyToParse Event Response JSON:\n', req.json())
        return req
Beispiel #5
0
    def c_appearance(cls, **confs):
        """
        Used to set matched region properties. These properties
        can be background, foreground etc. 

        Check Tkinter Text widget documentation on tags for more info.
        """

        cls.confs.update(confs)
        printd('Find - Setting confs = ', cls.confs)
Beispiel #6
0
    def buffer_unload(self, line, col, path, data):
        """
        When an AreaVi instance is destroyed it is sent.
        It is useful to lower resource consume.
        """

        req = self.e_send('BufferUnload', line, col, path, data)
        printd('Ycmd - BufferUnload status', req.status_code)
        printd('Ycmd - BufferUnload Event Response JSON:\n', req.json())
        return req
Beispiel #7
0
Datei: mc.py Projekt: smiled0g/vy
    def c_appearance(cls, dir, file):
        """
        Used to configure foreground/background for directory entries.

        Check Tkinter Text widget tags for more info.
        """

        cls.confs['(MC-DIRECTORY)'] = dir
        cls.confs['(MC-FILE)'] = file

        printd('Mc - Setting dir/file appearance confs = ', cls.confs)
Beispiel #8
0
    def on_unload(self, event):
        """
        """
        data = {
            self.area.filename: {
                'filetypes': [FILETYPES[self.area.extension]],
                'contents': self.area.get('1.0', 'end')
            }
        }

        req = self.server.buffer_unload(1, 1, self.area.filename, data)
        printd('Ycmd - BufferUnload status', req.status_code)
        printd('Ycmd - BufferUnload JSON response', req.json())
Beispiel #9
0
    def is_alive(self):
        """
        """
        hmac_secret = self.hmac_req('GET', '/healthy', '', self.hmac_secret)

        url = '%s/healthy' % self.url
        headers = {
            'X-YCM-HMAC': hmac_secret,
        }

        req = self.get(url, headers=headers)
        printd('Ycmd - /healthy response status..\n', req.status_code)
        printd('Ycmd - /healthy response JSON', req.json())
Beispiel #10
0
    def  __init__(self, area):
        self.area = area

        area.install('sniper', 
        ('NORMAL', '<Key-b>', lambda event: self.options.display()),
        ('NORMAL', '<Key-B>', lambda event: Get(events = {
        '<Return>':self.find, 
        '<Control-i>':self.set_ignore_regex, 
        '<Control-x>':self.set_type_lax, 
        '<Control-r>':self.set_type_regex, 
        '<Control-l>':self.set_type_literal, 
        '<Control-g>':self.set_file_regex, 
        '<Control-s>':self.set_nocase, 
        '<Control-w>':self.set_wide, 
        '<Control-m>':self.set_multiline, 
        '<Escape>':  lambda wid: True})))

        if not self.dirs:
            printd('Sniper - Sniper.dirs is not set.')
Beispiel #11
0
    def debug_info(self, line, col, path, data):
        data = {
            'line_num': line,
            'column_num': col,
            'filepath': path,
            'file_data': data
        }

        url = '%s/debug_info' % self.url
        hmac_secret = self.hmac_req('POST', '/debug_info', data,
                                    self.hmac_secret)

        headers = {
            'X-YCM-HMAC': hmac_secret,
        }

        req = self.post(url, json=data, headers=headers, timeout=2)
        printd('Ycmd - debug_info Event Response JSON:\n', req.json())
        return req
Beispiel #12
0
    def load_conf(self, path):
        """
        """

        data = {
            'filepath': path,
        }

        url = '%s/load_extra_conf_file' % self.url
        hmac_secret = self.hmac_req('POST', '/load_extra_conf_file', data,
                                    self.hmac_secret)

        headers = {
            'X-YCM-HMAC': hmac_secret,
        }

        req = self.post(url, json=data, headers=headers)

        printd('Ycmd - Loading extra conf...', path)
        printd('Ycmd - Load conf response:', req.json())
Beispiel #13
0
 def c_path(cls, path):
     printd('Deadcode - Setting Vulture path = ', cls.path)
     cls.path = path
Beispiel #14
0
 def c_sentinels(cls, *sentinels):
     cls.sentinels = sentinels
     printd('Project - Setting sentinels = ', cls.sentinels)
Beispiel #15
0
 def c_path(cls, path):
     printd('Snakerr - Setting Mypy path = ', cls.path)
     cls.path = path
Beispiel #16
0
 def c_path(cls, path):
     printd('Snakerr - Setting Pyflakes path = ', cls.path)
     cls.path = path
Beispiel #17
0
 def c_dirs(cls, *dirs):
     """
     Folders where ag will be searching for data.
     """
     cls.dirs = dirs
     printd('Sniper - Setting dirs =', *dirs)
Beispiel #18
0
 def c_path(cls, path='ag'):
     cls.path = path
     printd('Fstmt - Setting ag path = ', path)