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

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

View File

@ -77,4 +77,6 @@ void EmitInactiveLines(WorkingFile* working_file,
void EmitSemanticHighlighting(QueryDatabase* db,
SemanticHighlightSymbolCache* semantic_cache,
WorkingFile* working_file,
QueryFile* file);
QueryFile* file);
bool ShouldIgnoreFileForIndexing(const std::string& path);

View File

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

View File

@ -22,6 +22,9 @@ struct TextDocumentDidSaveHandler
: BaseMessageHandler<Ipc_TextDocumentDidSave> {
void Run(Ipc_TextDocumentDidSave* request) override {
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
// can update the cached index contents when the index is done.
//
@ -43,4 +46,4 @@ struct TextDocumentDidSaveHandler
}
};
REGISTER_MESSAGE_HANDLER(TextDocumentDidSaveHandler);
} // namespace
} // namespace