mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-11-04 06:15:20 +00:00 
			
		
		
		
	Misc fixes
This commit is contained in:
		
							parent
							
								
									f0fb8db3e5
								
							
						
					
					
						commit
						c262e1674d
					
				@ -140,6 +140,7 @@ void BuildDetailString(CXCompletionString completion_string, std::string& label,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    case CXCompletionChunk_Placeholder: {
 | 
			
		||||
      // TODO: insert $0 at end of snippet
 | 
			
		||||
      std::string text = clang::ToString(clang_getCompletionChunkText(completion_string, i));
 | 
			
		||||
      parameters->push_back(text);
 | 
			
		||||
      detail += text;
 | 
			
		||||
@ -357,13 +358,18 @@ void CompletionQueryMain(ClangCompleteManager* completion_manager) {
 | 
			
		||||
    // Build diagnostics.
 | 
			
		||||
    NonElidedVector<lsDiagnostic> ls_diagnostics;
 | 
			
		||||
    timer.Reset();
 | 
			
		||||
    /*
 | 
			
		||||
    unsigned num_diagnostics = clang_codeCompleteGetNumDiagnostics(cx_results);
 | 
			
		||||
    std::cerr << "!! There are " + std::to_string(num_diagnostics) + " diagnostics to build\n";
 | 
			
		||||
    for (unsigned i = 0; i < num_diagnostics; ++i) {
 | 
			
		||||
      optional<lsDiagnostic> diagnostic = BuildDiagnostic(clang_codeCompleteGetDiagnostic(cx_results, i));
 | 
			
		||||
      std::cerr << "!! Building diagnostic " + std::to_string(i) + "\n";
 | 
			
		||||
      CXDiagnostic cx_diag = clang_codeCompleteGetDiagnostic(cx_results, i);
 | 
			
		||||
      optional<lsDiagnostic> diagnostic = BuildDiagnostic(cx_diag);
 | 
			
		||||
      if (diagnostic)
 | 
			
		||||
        ls_diagnostics.push_back(*diagnostic);
 | 
			
		||||
    }
 | 
			
		||||
    timer.ResetAndPrint("[complete] Build diagnostics");
 | 
			
		||||
    */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    clang_disposeCodeCompleteResults(cx_results);
 | 
			
		||||
@ -410,7 +416,7 @@ void LruSessionCache::InsertEntry(std::unique_ptr<CompletionSession> session) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ClangCompleteManager::ParseRequest::ParseRequest(const std::string& path)
 | 
			
		||||
  : path(path), request_time(std::chrono::high_resolution_clock::now()) {}
 | 
			
		||||
  : request_time(std::chrono::high_resolution_clock::now()), path(path) {}
 | 
			
		||||
 | 
			
		||||
ClangCompleteManager::ClangCompleteManager(Config* config, Project* project, WorkingFiles* working_files)
 | 
			
		||||
    : config_(config), project_(project), working_files_(working_files),
 | 
			
		||||
 | 
			
		||||
@ -24,8 +24,11 @@ lsRange GetLsRangeForFixIt(const CXSourceRange& range) {
 | 
			
		||||
optional<lsDiagnostic> BuildDiagnostic(CXDiagnostic diagnostic) {
 | 
			
		||||
  // Skip diagnostics in system headers.
 | 
			
		||||
  CXSourceLocation diag_loc = clang_getDiagnosticLocation(diagnostic);
 | 
			
		||||
  if (clang_Location_isInSystemHeader(diag_loc))
 | 
			
		||||
  if (clang_equalLocations(diag_loc, clang_getNullLocation()) ||
 | 
			
		||||
      clang_Location_isInSystemHeader(diag_loc)) {
 | 
			
		||||
    clang_disposeDiagnostic(diagnostic);
 | 
			
		||||
    return nullopt;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  // Get db so we can attribute diagnostic to the right indexed file.
 | 
			
		||||
  CXFile file;
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@
 | 
			
		||||
#include <rapidjson/istreamwrapper.h>
 | 
			
		||||
#include <rapidjson/ostreamwrapper.h>
 | 
			
		||||
 | 
			
		||||
#include <climits>
 | 
			
		||||
#include <fstream>
 | 
			
		||||
#include <functional>
 | 
			
		||||
#include <iostream>
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user