Пример #1
0
 def __init__(self, vim):
     Ncm2Source.__init__(self, vim)
     self.vim = vim
     self.vim.vars["ncm2_lsp#_results"] = []
     self.vim.vars["ncm2_lsp#_success"] = False
     self.vim.vars["ncm2_lsp#_requested"] = False
     self.vim.vars["ncm2_lsp#_prev_input"] = ""
     if "ncm2_lsp#use_icons_for_candidates" not in self.vim.vars:
         self.vim.vars["ncm2_lsp#use_icons_for_candidates"] = False
     self.lsp_kinds = LSP_KINDS
Пример #2
0
    def __init__(self, vim):
        Ncm2Source.__init__(self, vim)

        env = vim.vars['ncm2_jedi#environment']
        if not env:
            self._env = jedi.get_default_environment()
        else:
            self._env = jedi.create_environment(env)

        rc_settings = vim.vars['ncm2_jedi#settings']
        for name in rc_settings:
            setattr(settings, name, rc_settings[name])
Пример #3
0
    def __init__(self, nvim):
        Ncm2Source.__init__(self, nvim)

        self.vim = nvim
        alchemist_script = "%s/elixir_sense/run.exs" % PLUGIN_BASE_PATH
        self.re_completions = re.compile(
            r'kind:(?P<kind>[^,]*), word:(?P<word>[^,]*), abbr:(?P<abbr>[\w\W]*), menu:(?P<menu>[\w\W]*), info:(?P<info>[\w\W]*)$'
        )
        self.re_is_only_func = re.compile(r'^[a-z]')

        self.sense_client = ElixirSenseClient(
            debug=DEBUG,
            cwd=os.getcwd(),
            ansi=False,
            elixir_sense_script=alchemist_script,
            elixir_otp_src="")
Пример #4
0
    def __init__(self, vim):
        Ncm2Source.__init__(self, vim)

        env = vim.vars['ncm2_jedi#environment']
        if not env:
            osenv = os.environ
            if 'VIRTUAL_ENV' not in osenv and 'CONDA_PREFIX' in osenv:
                # if conda is active
                self._env = jedi.create_environment(osenv['CONDA_PREFIX'])
            else:
                # get_default_environment handles VIRTUAL_ENV
                self._env = jedi.get_default_environment()
        else:
            self._env = jedi.create_environment(env)

        rc_settings = vim.vars['ncm2_jedi#settings']
        for name in rc_settings:
            setattr(settings, name, rc_settings[name])
Пример #5
0
    def __init__(self, nvim):
        Ncm2Source.__init__(self, nvim)

        library_path = nvim.vars['ncm2_pyclang#library_path']
        if path.isdir(library_path):
            cindex.Config.set_library_path(library_path)
        elif path.isfile(library_path):
            cindex.Config.set_library_file(library_path)

        cindex.Config.set_compatibility_check(False)

        self.cmpl_index = cindex.Index.create(excludeDecls=False)
        self.goto_index = cindex.Index.create(excludeDecls=False)

        self.cmpl_tu = {}
        self.goto_tu = {}

        self.queue = queue.Queue()
        self.worker = threading.Thread(target=self.worker_loop)
        self.worker.daemon = True
        self.worker.start()
Пример #6
0
 def __init__(self, vim):
     Ncm2Source.__init__(self, vim)
     self.idenclass = {
         "c": "class",
         "i": "interface",
         "s": "struct",
         "u": "union",
         "v": "var",
         "m": "var",
         "k": "keyword",
         "f": "function",
         "g": "enum",
         "e": "enum",
         "P": "package",
         "M": "module",
         "a": "array",
         "A": "aarray",
         "l": "alias",
         "t": "template",
         "T": "mixin template",
     }
Пример #7
0
    def __init__(self, nvim):
        Ncm2Source.__init__(self, nvim)

        library_path = nvim.vars['ncm2_pyclang#library_path']
        if path.isdir(library_path):
            cindex.Config.set_library_path(library_path)
        elif path.isfile(library_path):
            cindex.Config.set_library_file(library_path)

        cindex.Config.set_compatibility_check(False)

        self.cmpl_index = cindex.Index.create(excludeDecls=False)
        self.goto_index = cindex.Index.create(excludeDecls=False)

        self.cmpl_tu = {}
        self.goto_tu = {}

        self.queue = queue.Queue()
        self.worker = threading.Thread(target=self.worker_loop)
        self.worker.daemon = True
        self.worker.start()

        gcc_path = nvim.vars['ncm2_pyclang#gcc_path']

        auto_detect = nvim.vars['ncm2_pyclang#detect_sys_inc_args']

        sys_inc = {}
        gcc_exe = find_executable(gcc_path)
        if auto_detect and gcc_exe:
            sys_inc['cpp'] = self.get_system_include(gcc_exe, ['-xc++'])
            sys_inc['c'] = self.get_system_include(gcc_exe, ['-xc'])
        else:
            if auto_detect:
                # warning if auto detection failed
                nvim.call('ncm2_pyclang#warn', 'g:ncm2_pyclang#gcc_path(' + gcc_path \
                        + ' exe not found, use ncm2_pyclang#sys_inc_args_fallback')
            sys_inc = nvim.vars['ncm2_pyclang#sys_inc_args_fallback']

        self.args_system_include = sys_inc
Пример #8
0
    def __init__(self, nvim):
        Ncm2Source.__init__(self, nvim)

        this_file = path.abspath(__file__)
        basedir = path.dirname(this_file)
        basedir = path.dirname(basedir)

        ncm_libclang_bin = nvim.vars['ncm2_libclang#bin']
        if type(ncm_libclang_bin) == str:
            ncm_libclang_bin = [ncm_libclang_bin]

        ncm_libclang_bin[0] = path.join(basedir, ncm_libclang_bin[0])

        if not path.isfile(ncm_libclang_bin[0]):
            raise Exception("%s doesn't exist, please compile it" %
                            ncm_libclang_bin[0])

        self.proc = Popen(args=ncm_libclang_bin,
                          stdin=subprocess.PIPE,
                          stdout=subprocess.PIPE,
                          stderr=subprocess.DEVNULL)

        nvim.command("call ncm2_libclang#on_warmup(ncm2#context())",
                     async_=True)