Пример #1
0
    def ComputeCandidatesInner(self, request_data):
        current_line = request_data['line_value']
        start_column = request_data['start_column']
        filepath = request_data['filepath']
        filetypes = request_data['file_data'][filepath]['filetypes']
        line = current_line[:start_column]

        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,
                                             filepath))

        path_match = self._path_regex.search(line)
        path_dir = os.path.expanduser(path_match.group()) if path_match else ''

        return _GenerateCandidatesForPaths(
            _GetPathsStandardCase(
                path_dir,
                self.user_options['filepath_completion_use_working_dir'],
                filepath))
Пример #2
0
 def AtIncludeStatementStart(self, request_data):
     start_column = request_data['start_column']
     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]))
Пример #3
0
  def ComputeCandidates( self, unused_query, start_column ):
    line = vim.current.line[ :start_column ]

    if InCFamilyFile():
      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 ) )

    path_match = self._path_regex.search( line )
    path_dir = os.path.expanduser( path_match.group() ) if path_match else ''

    return GenerateCandidatesForPaths( GetPathsStandardCase( path_dir ) )
Пример #4
0
 def AtIncludeStatementStart( self, start_column ):
   return ( InCFamilyFile() and
            self._include_start_regex.match(
              vim.current.line[ :start_column ] ) )