Do not index files starting with git:

This commit is contained in:
Jacob Dufault 2017-12-06 17:00:19 -08:00
parent 3b9371f4b5
commit ae8cae5ba6
4 changed files with 16 additions and 4 deletions

View File

@ -147,3 +147,7 @@ void EmitSemanticHighlighting(QueryDatabase* db,
out.params.symbols.push_back(entry.second); out.params.symbols.push_back(entry.second);
IpcManager::WriteStdout(IpcId::CqueryPublishSemanticHighlighting, out); IpcManager::WriteStdout(IpcId::CqueryPublishSemanticHighlighting, out);
} }
bool ShouldIgnoreFileForIndexing(const std::string& path) {
return StartsWith(path, "git:");
}

View File

@ -78,3 +78,5 @@ void EmitSemanticHighlighting(QueryDatabase* db,
SemanticHighlightSymbolCache* semantic_cache, SemanticHighlightSymbolCache* semantic_cache,
WorkingFile* working_file, WorkingFile* working_file,
QueryFile* file); QueryFile* file);
bool ShouldIgnoreFileForIndexing(const std::string& path);

View File

@ -24,6 +24,9 @@ struct TextDocumentDidOpenHandler
Timer time; Timer time;
std::string path = request->params.textDocument.uri.GetPath(); std::string path = request->params.textDocument.uri.GetPath();
if (ShouldIgnoreFileForIndexing(path))
return;
WorkingFile* working_file = WorkingFile* working_file =
working_files->OnOpen(request->params.textDocument); working_files->OnOpen(request->params.textDocument);
optional<std::string> cached_file_contents = optional<std::string> cached_file_contents =

View File

@ -22,6 +22,9 @@ struct TextDocumentDidSaveHandler
: BaseMessageHandler<Ipc_TextDocumentDidSave> { : BaseMessageHandler<Ipc_TextDocumentDidSave> {
void Run(Ipc_TextDocumentDidSave* request) override { void Run(Ipc_TextDocumentDidSave* request) override {
std::string path = request->params.textDocument.uri.GetPath(); std::string path = request->params.textDocument.uri.GetPath();
if (ShouldIgnoreFileForIndexing(path))
return;
// Send out an index request, and copy the current buffer state so we // Send out an index request, and copy the current buffer state so we
// can update the cached index contents when the index is done. // can update the cached index contents when the index is done.
// //