mirror of
https://github.com/MaskRay/ccls.git
synced 2025-03-30 13:32:13 +00:00
limit workspace result to 1000, fix workspace file search
This commit is contained in:
parent
5d451e020a
commit
443ccd24b9
@ -27,6 +27,7 @@ const char* kIpcLanguageClientName = "language_client";
|
|||||||
|
|
||||||
const int kNumIndexers = 8 - 1;
|
const int kNumIndexers = 8 - 1;
|
||||||
const int kQueueSizeBytes = 1024 * 8;
|
const int kQueueSizeBytes = 1024 * 8;
|
||||||
|
const int kMaxWorkspaceSearchResults = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct IndexTranslationUnitRequest {
|
struct IndexTranslationUnitRequest {
|
||||||
@ -670,6 +671,11 @@ void QueryDbMainLoop(
|
|||||||
|
|
||||||
std::string query = msg->params.query;
|
std::string query = msg->params.query;
|
||||||
for (int i = 0; i < db->qualified_names.size(); ++i) {
|
for (int i = 0; i < db->qualified_names.size(); ++i) {
|
||||||
|
if (response.result.size() > kMaxWorkspaceSearchResults) {
|
||||||
|
std::cerr << "Query exceeded maximum number of responses (" << kMaxWorkspaceSearchResults << "), output may not contain all results";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& name = db->qualified_names[i];
|
const std::string& name = db->qualified_names[i];
|
||||||
// std::cerr << "- Considering " << name << std::endl;
|
// std::cerr << "- Considering " << name << std::endl;
|
||||||
|
|
||||||
@ -682,6 +688,11 @@ void QueryDbMainLoop(
|
|||||||
// TODO: dedup this code w/ above (ie, add ctor to convert symbol to
|
// TODO: dedup this code w/ above (ie, add ctor to convert symbol to
|
||||||
// SymbolInformation)
|
// SymbolInformation)
|
||||||
switch (symbol.kind) {
|
switch (symbol.kind) {
|
||||||
|
case SymbolKind::File: {
|
||||||
|
QueryableFile& def = db->files[symbol.idx];
|
||||||
|
info.location.uri.SetPath(def.def.usr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
// TODO: file
|
// TODO: file
|
||||||
case SymbolKind::Type: {
|
case SymbolKind::Type: {
|
||||||
QueryableTypeDef& def = db->types[symbol.idx];
|
QueryableTypeDef& def = db->types[symbol.idx];
|
||||||
@ -948,7 +959,7 @@ int main(int argc, char** argv) {
|
|||||||
//bool loop = true;
|
//bool loop = true;
|
||||||
//while (loop)
|
//while (loop)
|
||||||
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
// std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
//std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||||
|
|
||||||
PlatformInit();
|
PlatformInit();
|
||||||
RegisterMessageTypes();
|
RegisterMessageTypes();
|
||||||
|
@ -86,9 +86,6 @@ IndexedTypeDef::IndexedTypeDef(TypeId id, const std::string& usr)
|
|||||||
void AddUsage(std::vector<Range>& uses,
|
void AddUsage(std::vector<Range>& uses,
|
||||||
Range loc,
|
Range loc,
|
||||||
bool insert_if_not_present = true) {
|
bool insert_if_not_present = true) {
|
||||||
if (loc.start.column == 7 && loc.start.line == 7)
|
|
||||||
std::cerr << "break;";
|
|
||||||
|
|
||||||
// TODO: think about if we need to also consider |uses[i].end|
|
// TODO: think about if we need to also consider |uses[i].end|
|
||||||
// First thought makes me think no, we don't.
|
// First thought makes me think no, we don't.
|
||||||
for (int i = uses.size() - 1; i >= 0; --i) {
|
for (int i = uses.size() - 1; i >= 0; --i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user