def ShouldEnableRustCompleter(user_options): if GetExecutable(user_options['rls_binary_path']): if GetExecutable(user_options['rustc_binary_path']): return True else: LOGGER.error( 'rustc_binary_path not specified, rls_binary_path ignored') if not RLS_EXECUTABLE: LOGGER.error('Not using Rust completer: no RLS executable found at %s', RLS_EXECUTABLE) return False LOGGER.info('Using Rust completer') return True
def GetClangdExecutableAndResourceDir(user_options): """Return the Clangd binary from the path specified in the 'clangd_binary_path' option. Let the binary find its resource directory in that case. If no binary is found or if it's out-of-date, return nothing. If 'clangd_binary_path' is empty, return the third-party Clangd and its resource directory if the user downloaded it and if it's up to date. Otherwise, return nothing.""" clangd = user_options['clangd_binary_path'] resource_dir = None if clangd: clangd = GetExecutable(ExpandVariablesInPath(clangd)) if not clangd: LOGGER.error('No Clangd executable found at %s', user_options['clangd_binary_path']) return None, None if not CheckClangdVersion(clangd): LOGGER.error('Clangd at %s is out-of-date', clangd) return None, None # Try looking for the pre-built binary. else: third_party_clangd = GetThirdPartyClangd() if not third_party_clangd: return None, None clangd = third_party_clangd resource_dir = CLANG_RESOURCE_DIR LOGGER.info('Using Clangd from %s', clangd) return clangd, resource_dir
def __init__(self, user_options): rls_binary_path = GetExecutable(user_options['rls_binary_path']) if rls_binary_path: self._rls_binary_path = rls_binary_path self._rustc_binary_path = user_options['rustc_binary_path'] else: self._rls_binary_path = RLS_EXECUTABLE self._rustc_binary_path = RUSTC_EXECUTABLE super(RustCompleter, self).__init__(user_options)
def GetThirdPartyClangd(): pre_built_clangd = GetExecutable( PRE_BUILT_CLANDG_PATH ) if not pre_built_clangd: LOGGER.info( 'No Clangd executable found in %s', PRE_BUILT_CLANGD_DIR ) return None if not CheckClangdVersion( pre_built_clangd ): LOGGER.error( 'Clangd executable at %s is out-of-date', pre_built_clangd ) return None LOGGER.info( 'Clangd executable found at %s and up to date', PRE_BUILT_CLANGD_DIR ) return pre_built_clangd
def FindTSServer(user_options): tsserver_binary_path = GetExecutable(user_options['tsserver_binary_path']) if tsserver_binary_path: return tsserver_binary_path # The TSServer executable is installed at the root directory on Windows while # it's installed in the bin folder on other platforms. for executable in [ os.path.join(TSSERVER_DIR, 'bin', 'tsserver'), os.path.join(TSSERVER_DIR, 'tsserver'), 'tsserver' ]: tsserver = utils.FindExecutable(executable) if tsserver: return tsserver return None