def ComputeCandidatesInner( self, request_data ): current_line = request_data[ 'line_value' ] start_column = request_data[ 'start_column' ] - 1 orig_filepath = request_data[ 'filepath' ] filetypes = request_data[ 'file_data' ][ orig_filepath ][ 'filetypes' ] line = current_line[ :start_column ] utf8_filepath = ToUtf8IfNeeded( orig_filepath ) if InCFamilyFile( filetypes ): path_dir, quoted_include = ( GetIncludeStatementValue( line, check_closing = False ) ) if path_dir is not None: # We do what GCC does for <> versus "": # http://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html client_data = request_data.get( 'extra_conf_data', None ) return _GenerateCandidatesForPaths( self.GetPathsIncludeCase( path_dir, quoted_include, utf8_filepath, client_data ) ) path_match = self._path_regex.search( line ) path_dir = os.path.expanduser( os.path.expandvars( path_match.group() ) ) if path_match else '' # If the client supplied its working directory, use that instead of the # working directory of ycmd working_dir = request_data.get( 'working_dir' ) return _GenerateCandidatesForPaths( _GetPathsStandardCase( path_dir, self.user_options[ 'filepath_completion_use_working_dir' ], utf8_filepath, working_dir) )
def ComputeCandidatesInner(self, request_data): current_line = request_data['line_value'] start_column = request_data['start_column'] - 1 orig_filepath = request_data['filepath'] filetypes = request_data['file_data'][orig_filepath]['filetypes'] line = current_line[:start_column] utf8_filepath = ToUtf8IfNeeded(orig_filepath) if InCFamilyFile(filetypes): include_match = self._include_regex.search(line) if include_match: path_dir = line[include_match.end():] # We do what GCC does for <> versus "": # http://gcc.gnu.org/onlinedocs/cpp/Include-Syntax.html include_current_file_dir = '<' not in include_match.group() return _GenerateCandidatesForPaths( self.GetPathsIncludeCase(path_dir, include_current_file_dir, utf8_filepath)) path_match = self._path_regex.search(line) path_dir = os.path.expanduser(os.path.expandvars( path_match.group())) if path_match else '' return _GenerateCandidatesForPaths( _GetPathsStandardCase( path_dir, self.user_options['filepath_completion_use_working_dir'], utf8_filepath))
def ShouldCompleteIncludeStatement( self, request_data ): start_column = request_data[ 'start_column' ] - 1 current_line = request_data[ 'line_value' ] filepath = request_data[ 'filepath' ] filetypes = request_data[ 'file_data' ][ filepath ][ 'filetypes' ] return ( InCFamilyFile( filetypes ) and AtIncludeStatementStart( current_line[ :start_column ] ) )
def AtIncludeStatementStart(self, request_data): start_column = request_data['start_column'] - 1 current_line = request_data['line_value'] filepath = request_data['filepath'] filetypes = request_data['file_data'][filepath]['filetypes'] return (InCFamilyFile(filetypes) and self._include_start_regex.match( current_line[:start_column]))