mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-11-03 22:04:24 +00:00 
			
		
		
		
	Run ./format.sh
This commit is contained in:
		
							parent
							
								
									066166ba40
								
							
						
					
					
						commit
						9b44bf7901
					
				@ -1578,8 +1578,8 @@ bool QueryDbMainLoop(Config* config,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
          // Open up / load the project.
 | 
					          // Open up / load the project.
 | 
				
			||||||
          project->Load(config->extraClangArguments,
 | 
					          project->Load(config->extraClangArguments,
 | 
				
			||||||
                        config->compilationDatabaseDirectory,
 | 
					                        config->compilationDatabaseDirectory, project_path,
 | 
				
			||||||
                        project_path, config->resourceDirectory);
 | 
					                        config->resourceDirectory);
 | 
				
			||||||
          time.ResetAndPrint("[perf] Loaded compilation entries (" +
 | 
					          time.ResetAndPrint("[perf] Loaded compilation entries (" +
 | 
				
			||||||
                             std::to_string(project->entries.size()) +
 | 
					                             std::to_string(project->entries.size()) +
 | 
				
			||||||
                             " files)");
 | 
					                             " files)");
 | 
				
			||||||
@ -2027,7 +2027,6 @@ bool QueryDbMainLoop(Config* config,
 | 
				
			|||||||
               is_global_completion, existing_completion,
 | 
					               is_global_completion, existing_completion,
 | 
				
			||||||
               msg](const NonElidedVector<lsCompletionItem>& results,
 | 
					               msg](const NonElidedVector<lsCompletionItem>& results,
 | 
				
			||||||
                    bool is_cached_result) {
 | 
					                    bool is_cached_result) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                Out_TextDocumentComplete complete_response;
 | 
					                Out_TextDocumentComplete complete_response;
 | 
				
			||||||
                complete_response.id = msg->id;
 | 
					                complete_response.id = msg->id;
 | 
				
			||||||
                complete_response.result.items = results;
 | 
					                complete_response.result.items = results;
 | 
				
			||||||
@ -2070,7 +2069,6 @@ bool QueryDbMainLoop(Config* config,
 | 
				
			|||||||
                [global_code_complete_cache](
 | 
					                [global_code_complete_cache](
 | 
				
			||||||
                    NonElidedVector<lsCompletionItem> results,
 | 
					                    NonElidedVector<lsCompletionItem> results,
 | 
				
			||||||
                    bool is_cached_result) {
 | 
					                    bool is_cached_result) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
                  assert(!is_cached_result);
 | 
					                  assert(!is_cached_result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                  // note: path is updated in the normal completion handler.
 | 
					                  // note: path is updated in the normal completion handler.
 | 
				
			||||||
 | 
				
			|||||||
@ -1188,8 +1188,10 @@ void indexDeclaration(CXClientData client_data, const CXIdxDeclInfo* decl) {
 | 
				
			|||||||
      if (!is_template_specialization) {
 | 
					      if (!is_template_specialization) {
 | 
				
			||||||
        func->def.short_name = decl->entityInfo->name;
 | 
					        func->def.short_name = decl->entityInfo->name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Set the |is_operator| flag to true if the function name starts with "operator"
 | 
					        // Set the |is_operator| flag to true if the function name starts with
 | 
				
			||||||
        func->def.is_operator = func->def.short_name.compare(0, 8, "operator") == 0;
 | 
					        // "operator"
 | 
				
			||||||
 | 
					        func->def.is_operator =
 | 
				
			||||||
 | 
					            func->def.short_name.compare(0, 8, "operator") == 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Build detailed name. The type desc looks like void (void *). We
 | 
					        // Build detailed name. The type desc looks like void (void *). We
 | 
				
			||||||
        // insert the qualified name before the first '('.
 | 
					        // insert the qualified name before the first '('.
 | 
				
			||||||
 | 
				
			|||||||
@ -471,12 +471,7 @@ struct IndexInclude {
 | 
				
			|||||||
// Used to identify the language at a file level. The ordering is important, as
 | 
					// Used to identify the language at a file level. The ordering is important, as
 | 
				
			||||||
// a file previously identified as `C`, will be changed to `Cpp` if it
 | 
					// a file previously identified as `C`, will be changed to `Cpp` if it
 | 
				
			||||||
// encounters a c++ declaration.
 | 
					// encounters a c++ declaration.
 | 
				
			||||||
enum class LanguageId {
 | 
					enum class LanguageId { Unknown = 0, C = 1, Cpp = 2, ObjC = 3 };
 | 
				
			||||||
  Unknown = 0,
 | 
					 | 
				
			||||||
  C = 1,
 | 
					 | 
				
			||||||
  Cpp = 2,
 | 
					 | 
				
			||||||
  ObjC = 3
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
MAKE_REFLECT_TYPE_PROXY(LanguageId, std::underlying_type<LanguageId>::type);
 | 
					MAKE_REFLECT_TYPE_PROXY(LanguageId, std::underlying_type<LanguageId>::type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct IndexFile {
 | 
					struct IndexFile {
 | 
				
			||||||
 | 
				
			|||||||
@ -1180,17 +1180,19 @@ MAKE_REFLECT_STRUCT(lsSignatureHelp,
 | 
				
			|||||||
                    activeSignature,
 | 
					                    activeSignature,
 | 
				
			||||||
                    activeParameter);
 | 
					                    activeParameter);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// MarkedString can be used to render human readable text. It is either a markdown string
 | 
					// MarkedString can be used to render human readable text. It is either a
 | 
				
			||||||
// or a code-block that provides a language and a code snippet. The language identifier
 | 
					// markdown string or a code-block that provides a language and a code snippet.
 | 
				
			||||||
// is sematically equal to the optional language identifier in fenced code blocks in GitHub
 | 
					// The language identifier is sematically equal to the optional language
 | 
				
			||||||
// issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
 | 
					// identifier in fenced code blocks in GitHub issues. See
 | 
				
			||||||
 | 
					// https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// The pair of a language and a value is an equivalent to markdown:
 | 
					// The pair of a language and a value is an equivalent to markdown:
 | 
				
			||||||
// ```${language}
 | 
					// ```${language}
 | 
				
			||||||
// ${value}
 | 
					// ${value}
 | 
				
			||||||
// ```
 | 
					// ```
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Note that markdown strings will be sanitized - that means html will be escaped.
 | 
					// Note that markdown strings will be sanitized - that means html will be
 | 
				
			||||||
 | 
					// escaped.
 | 
				
			||||||
struct lsMarkedString {
 | 
					struct lsMarkedString {
 | 
				
			||||||
  std::string language;
 | 
					  std::string language;
 | 
				
			||||||
  std::string value;
 | 
					  std::string value;
 | 
				
			||||||
 | 
				
			|||||||
@ -42,8 +42,8 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns the canonicalized absolute pathname, without expanding symbolic links.
 | 
					// Returns the canonicalized absolute pathname, without expanding symbolic
 | 
				
			||||||
// This is a variant of realpath(2), C++ rewrite of
 | 
					// links. This is a variant of realpath(2), C++ rewrite of
 | 
				
			||||||
// https://github.com/freebsd/freebsd/blob/master/lib/libc/stdlib/realpath.c
 | 
					// https://github.com/freebsd/freebsd/blob/master/lib/libc/stdlib/realpath.c
 | 
				
			||||||
optional<std::string> RealPathNotExpandSymlink(std::string path) {
 | 
					optional<std::string> RealPathNotExpandSymlink(std::string path) {
 | 
				
			||||||
  if (path.empty()) {
 | 
					  if (path.empty()) {
 | 
				
			||||||
 | 
				
			|||||||
@ -202,8 +202,7 @@ std::vector<Project::Entry> LoadFromDirectoryListing(ProjectConfig* config) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  std::vector<std::string> args;
 | 
					  std::vector<std::string> args;
 | 
				
			||||||
  std::cerr << "Using arguments: ";
 | 
					  std::cerr << "Using arguments: ";
 | 
				
			||||||
  for (const std::string& line :
 | 
					  for (const std::string& line : ReadLines(config->project_dir + "/.cquery")) {
 | 
				
			||||||
       ReadLines(config->project_dir + "/.cquery")) {
 | 
					 | 
				
			||||||
    if (line.empty() || StartsWith(line, "#"))
 | 
					    if (line.empty() || StartsWith(line, "#"))
 | 
				
			||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
    if (!args.empty())
 | 
					    if (!args.empty())
 | 
				
			||||||
@ -241,8 +240,7 @@ std::vector<Project::Entry> LoadCompilationEntriesFromDirectory(
 | 
				
			|||||||
      compilation_db_dir.c_str(), &cx_db_load_error);
 | 
					      compilation_db_dir.c_str(), &cx_db_load_error);
 | 
				
			||||||
  if (cx_db_load_error == CXCompilationDatabase_CanNotLoadDatabase) {
 | 
					  if (cx_db_load_error == CXCompilationDatabase_CanNotLoadDatabase) {
 | 
				
			||||||
    LOG_S(INFO) << "Unable to load compile_commands.json located at \""
 | 
					    LOG_S(INFO) << "Unable to load compile_commands.json located at \""
 | 
				
			||||||
                << compilation_db_dir
 | 
					                << compilation_db_dir << "\"; using directory listing instead.";
 | 
				
			||||||
                << "\"; using directory listing instead.";
 | 
					 | 
				
			||||||
    return LoadFromDirectoryListing(config);
 | 
					    return LoadFromDirectoryListing(config);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -351,8 +349,8 @@ void Project::Load(const std::vector<std::string>& extra_flags,
 | 
				
			|||||||
  config.extra_flags = extra_flags;
 | 
					  config.extra_flags = extra_flags;
 | 
				
			||||||
  config.project_dir = root_directory;
 | 
					  config.project_dir = root_directory;
 | 
				
			||||||
  config.resource_dir = resource_directory;
 | 
					  config.resource_dir = resource_directory;
 | 
				
			||||||
  entries = LoadCompilationEntriesFromDirectory(&config,
 | 
					  entries =
 | 
				
			||||||
                                                opt_compilation_db_dir);
 | 
					      LoadCompilationEntriesFromDirectory(&config, opt_compilation_db_dir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Cleanup / postprocess include directories.
 | 
					  // Cleanup / postprocess include directories.
 | 
				
			||||||
  quote_include_directories.assign(config.quote_dirs.begin(),
 | 
					  quote_include_directories.assign(config.quote_dirs.begin(),
 | 
				
			||||||
 | 
				
			|||||||
@ -33,9 +33,9 @@ struct Project {
 | 
				
			|||||||
  //
 | 
					  //
 | 
				
			||||||
  // If |opt_compilation_db_dir| is not empty, the compile_commands.json
 | 
					  // If |opt_compilation_db_dir| is not empty, the compile_commands.json
 | 
				
			||||||
  // file in it will be used to discover all files and args. If it's empty and
 | 
					  // file in it will be used to discover all files and args. If it's empty and
 | 
				
			||||||
  // |root_directory| contains a compile_commands.json file, that one will be used
 | 
					  // |root_directory| contains a compile_commands.json file, that one will be
 | 
				
			||||||
  // instead. Otherwise, a recursive directory listing of all *.cpp, *.cc, *.h,
 | 
					  // used instead. Otherwise, a recursive directory listing of all *.cpp, *.cc,
 | 
				
			||||||
  // and *.hpp files will be used. clang arguments can be specified in a
 | 
					  // *.h, and *.hpp files will be used. clang arguments can be specified in a
 | 
				
			||||||
  // .cquery file located inside of |root_directory|.
 | 
					  // .cquery file located inside of |root_directory|.
 | 
				
			||||||
  void Load(const std::vector<std::string>& extra_flags,
 | 
					  void Load(const std::vector<std::string>& extra_flags,
 | 
				
			||||||
            const std::string& opt_compilation_db_dir,
 | 
					            const std::string& opt_compilation_db_dir,
 | 
				
			||||||
 | 
				
			|||||||
@ -329,14 +329,17 @@ void WorkingFiles::OnChange(const Ipc_TextDocumentDidChange::Params& change) {
 | 
				
			|||||||
    // std::cerr << "|" << file->buffer_content << "|" << std::endl;
 | 
					    // std::cerr << "|" << file->buffer_content << "|" << std::endl;
 | 
				
			||||||
    // Per the spec replace everything if the rangeLength and range are not set.
 | 
					    // Per the spec replace everything if the rangeLength and range are not set.
 | 
				
			||||||
    // See https://github.com/Microsoft/language-server-protocol/issues/9.
 | 
					    // See https://github.com/Microsoft/language-server-protocol/issues/9.
 | 
				
			||||||
    if (diff.rangeLength == -1 && diff.range.start == lsPosition::kZeroPosition
 | 
					    if (diff.rangeLength == -1 &&
 | 
				
			||||||
        && diff.range.end == lsPosition::kZeroPosition) {
 | 
					        diff.range.start == lsPosition::kZeroPosition &&
 | 
				
			||||||
 | 
					        diff.range.end == lsPosition::kZeroPosition) {
 | 
				
			||||||
      file->buffer_content = diff.text;
 | 
					      file->buffer_content = diff.text;
 | 
				
			||||||
      file->OnBufferContentUpdated();
 | 
					      file->OnBufferContentUpdated();
 | 
				
			||||||
      // std::cerr << "-> Replacing entire content";
 | 
					      // std::cerr << "-> Replacing entire content";
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      int start_offset = GetOffsetForPosition(diff.range.start, file->buffer_content);
 | 
					      int start_offset =
 | 
				
			||||||
      int end_offset = GetOffsetForPosition(diff.range.end, file->buffer_content);
 | 
					          GetOffsetForPosition(diff.range.start, file->buffer_content);
 | 
				
			||||||
 | 
					      int end_offset =
 | 
				
			||||||
 | 
					          GetOffsetForPosition(diff.range.end, file->buffer_content);
 | 
				
			||||||
      int length = diff.rangeLength;
 | 
					      int length = diff.rangeLength;
 | 
				
			||||||
      if (length == -1) {
 | 
					      if (length == -1) {
 | 
				
			||||||
        length = end_offset - start_offset;
 | 
					        length = end_offset - start_offset;
 | 
				
			||||||
@ -346,8 +349,7 @@ void WorkingFiles::OnChange(const Ipc_TextDocumentDidChange::Params& change) {
 | 
				
			|||||||
      // start_offset << std::endl;
 | 
					      // start_offset << std::endl;
 | 
				
			||||||
      file->buffer_content.replace(
 | 
					      file->buffer_content.replace(
 | 
				
			||||||
          file->buffer_content.begin() + start_offset,
 | 
					          file->buffer_content.begin() + start_offset,
 | 
				
			||||||
          file->buffer_content.begin() + start_offset + length,
 | 
					          file->buffer_content.begin() + start_offset + length, diff.text);
 | 
				
			||||||
          diff.text);
 | 
					 | 
				
			||||||
      file->OnBufferContentUpdated();
 | 
					      file->OnBufferContentUpdated();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user