2017-12-05 07:57:41 +00:00
|
|
|
#include "message_handler.h"
|
|
|
|
|
2018-05-27 19:24:56 +00:00
|
|
|
#include "log.hh"
|
2018-07-09 02:56:33 +00:00
|
|
|
#include "pipeline.hh"
|
2018-01-06 21:40:33 +00:00
|
|
|
#include "project.h"
|
2017-12-06 03:32:33 +00:00
|
|
|
#include "query_utils.h"
|
2018-05-28 00:50:02 +00:00
|
|
|
using namespace ccls;
|
2017-12-06 03:32:33 +00:00
|
|
|
|
2018-06-01 21:22:55 +00:00
|
|
|
using namespace clang;
|
|
|
|
|
2018-01-10 03:04:08 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
2018-04-30 04:49:03 +00:00
|
|
|
MAKE_HASHABLE(SymbolIdx, t.usr, t.kind);
|
2018-04-08 17:32:08 +00:00
|
|
|
|
2018-01-10 03:04:08 +00:00
|
|
|
namespace {
|
2018-02-23 23:27:21 +00:00
|
|
|
|
2018-07-08 19:49:27 +00:00
|
|
|
struct Out_CclsSetSkippedRanges
|
|
|
|
: public lsOutMessage<Out_CclsSetSkippedRanges> {
|
2018-02-23 23:27:21 +00:00
|
|
|
struct Params {
|
|
|
|
lsDocumentUri uri;
|
2018-07-08 19:49:27 +00:00
|
|
|
std::vector<lsRange> skippedRanges;
|
2018-02-23 23:27:21 +00:00
|
|
|
};
|
2018-07-08 19:49:27 +00:00
|
|
|
std::string method = "$ccls/setSkippedRanges";
|
2018-02-23 23:27:21 +00:00
|
|
|
Params params;
|
|
|
|
};
|
2018-07-08 19:49:27 +00:00
|
|
|
MAKE_REFLECT_STRUCT(Out_CclsSetSkippedRanges::Params, uri, skippedRanges);
|
|
|
|
MAKE_REFLECT_STRUCT(Out_CclsSetSkippedRanges, jsonrpc, method, params);
|
2018-02-23 23:27:21 +00:00
|
|
|
|
2018-01-10 03:04:08 +00:00
|
|
|
struct ScanLineEvent {
|
|
|
|
lsPosition pos;
|
2018-07-09 02:56:33 +00:00
|
|
|
lsPosition end_pos; // Second key when there is a tie for insertion events.
|
2018-01-10 03:04:08 +00:00
|
|
|
int id;
|
2018-07-09 02:56:33 +00:00
|
|
|
Out_CclsPublishSemanticHighlighting::Symbol *symbol;
|
|
|
|
bool operator<(const ScanLineEvent &other) const {
|
2018-01-10 03:04:08 +00:00
|
|
|
// See the comments below when insertion/deletion events are inserted.
|
2018-02-22 17:43:53 +00:00
|
|
|
if (!(pos == other.pos))
|
|
|
|
return pos < other.pos;
|
|
|
|
if (!(other.end_pos == end_pos))
|
|
|
|
return other.end_pos < end_pos;
|
|
|
|
// This comparison essentially order Macro after non-Macro,
|
|
|
|
// So that macros will not be rendered as Var/Type/...
|
|
|
|
return symbol->kind < other.symbol->kind;
|
2018-01-10 03:04:08 +00:00
|
|
|
}
|
|
|
|
};
|
2018-07-09 02:56:33 +00:00
|
|
|
} // namespace
|
2018-01-10 03:04:08 +00:00
|
|
|
|
2018-03-31 05:05:21 +00:00
|
|
|
SemanticHighlightSymbolCache::Entry::Entry(
|
2018-07-09 02:56:33 +00:00
|
|
|
SemanticHighlightSymbolCache *all_caches, const std::string &path)
|
2018-03-31 05:05:21 +00:00
|
|
|
: all_caches_(all_caches), path(path) {}
|
|
|
|
|
|
|
|
std::optional<int> SemanticHighlightSymbolCache::Entry::TryGetStableId(
|
2018-07-09 02:56:33 +00:00
|
|
|
SymbolKind kind, const std::string &detailed_name) {
|
|
|
|
TNameToId *map = GetMapForSymbol_(kind);
|
2018-03-31 05:05:21 +00:00
|
|
|
auto it = map->find(detailed_name);
|
|
|
|
if (it != map->end())
|
|
|
|
return it->second;
|
|
|
|
|
|
|
|
return std::nullopt;
|
|
|
|
}
|
|
|
|
|
|
|
|
int SemanticHighlightSymbolCache::Entry::GetStableId(
|
2018-07-09 02:56:33 +00:00
|
|
|
SymbolKind kind, const std::string &detailed_name) {
|
2018-03-31 05:05:21 +00:00
|
|
|
std::optional<int> id = TryGetStableId(kind, detailed_name);
|
|
|
|
if (id)
|
|
|
|
return *id;
|
|
|
|
|
|
|
|
// Create a new id. First try to find a key in another map.
|
2018-07-09 02:56:33 +00:00
|
|
|
all_caches_->cache_.IterateValues([&](const std::shared_ptr<Entry> &entry) {
|
2018-03-31 05:05:21 +00:00
|
|
|
std::optional<int> other_id = entry->TryGetStableId(kind, detailed_name);
|
|
|
|
if (other_id) {
|
|
|
|
id = other_id;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Create a new id.
|
2018-07-09 02:56:33 +00:00
|
|
|
TNameToId *map = GetMapForSymbol_(kind);
|
2018-03-31 05:05:21 +00:00
|
|
|
if (!id)
|
|
|
|
id = all_caches_->next_stable_id_++;
|
|
|
|
return (*map)[detailed_name] = *id;
|
|
|
|
}
|
|
|
|
|
2018-07-09 02:56:33 +00:00
|
|
|
SemanticHighlightSymbolCache::Entry::TNameToId *
|
2018-03-31 05:05:21 +00:00
|
|
|
SemanticHighlightSymbolCache::Entry::GetMapForSymbol_(SymbolKind kind) {
|
|
|
|
switch (kind) {
|
2018-07-09 02:56:33 +00:00
|
|
|
case SymbolKind::Type:
|
|
|
|
return &detailed_type_name_to_stable_id;
|
|
|
|
case SymbolKind::Func:
|
|
|
|
return &detailed_func_name_to_stable_id;
|
|
|
|
case SymbolKind::Var:
|
|
|
|
return &detailed_var_name_to_stable_id;
|
|
|
|
case SymbolKind::File:
|
|
|
|
case SymbolKind::Invalid:
|
|
|
|
break;
|
2018-03-31 05:05:21 +00:00
|
|
|
}
|
|
|
|
assert(false);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
SemanticHighlightSymbolCache::SemanticHighlightSymbolCache()
|
|
|
|
: cache_(kCacheSize) {}
|
|
|
|
|
2018-04-04 06:05:41 +00:00
|
|
|
void SemanticHighlightSymbolCache::Init() {
|
|
|
|
match_ = std::make_unique<GroupMatch>(g_config->highlight.whitelist,
|
|
|
|
g_config->highlight.blacklist);
|
2018-03-31 05:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::shared_ptr<SemanticHighlightSymbolCache::Entry>
|
2018-07-09 02:56:33 +00:00
|
|
|
SemanticHighlightSymbolCache::GetCacheForFile(const std::string &path) {
|
2018-03-31 05:05:21 +00:00
|
|
|
return cache_.Get(
|
|
|
|
path, [&, this]() { return std::make_shared<Entry>(this, path); });
|
|
|
|
}
|
|
|
|
|
2017-12-05 07:57:41 +00:00
|
|
|
MessageHandler::MessageHandler() {
|
|
|
|
// Dynamically allocate |message_handlers|, otherwise there will be static
|
|
|
|
// initialization order races.
|
|
|
|
if (!message_handlers)
|
2018-07-09 02:56:33 +00:00
|
|
|
message_handlers = new std::vector<MessageHandler *>();
|
2017-12-05 07:57:41 +00:00
|
|
|
message_handlers->push_back(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
// static
|
2018-07-09 02:56:33 +00:00
|
|
|
std::vector<MessageHandler *> *MessageHandler::message_handlers = nullptr;
|
|
|
|
|
|
|
|
bool FindFileOrFail(DB *db, Project *project, std::optional<lsRequestId> id,
|
|
|
|
const std::string &absolute_path,
|
|
|
|
QueryFile **out_query_file, int *out_file_id) {
|
2017-12-06 03:32:33 +00:00
|
|
|
*out_query_file = nullptr;
|
|
|
|
|
2018-04-30 04:49:03 +00:00
|
|
|
auto it = db->name2file_id.find(LowerPathIfInsensitive(absolute_path));
|
|
|
|
if (it != db->name2file_id.end()) {
|
2018-07-09 02:56:33 +00:00
|
|
|
QueryFile &file = db->files[it->second];
|
2017-12-06 03:32:33 +00:00
|
|
|
if (file.def) {
|
|
|
|
*out_query_file = &file;
|
|
|
|
if (out_file_id)
|
2018-04-30 04:49:03 +00:00
|
|
|
*out_file_id = it->second;
|
2017-12-06 03:32:33 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (out_file_id)
|
2018-04-30 04:49:03 +00:00
|
|
|
*out_file_id = -1;
|
2017-12-06 03:32:33 +00:00
|
|
|
|
2018-05-05 22:29:17 +00:00
|
|
|
bool indexing;
|
|
|
|
{
|
|
|
|
std::lock_guard<std::mutex> lock(project->mutex_);
|
|
|
|
indexing = project->absolute_path_to_entry_index_.find(absolute_path) !=
|
2018-07-09 02:56:33 +00:00
|
|
|
project->absolute_path_to_entry_index_.end();
|
2018-05-05 22:29:17 +00:00
|
|
|
}
|
2017-12-31 03:18:33 +00:00
|
|
|
if (indexing)
|
|
|
|
LOG_S(INFO) << "\"" << absolute_path << "\" is being indexed.";
|
|
|
|
else
|
2018-05-27 19:24:56 +00:00
|
|
|
LOG_S(INFO) << "unable to find file \"" << absolute_path << "\"";
|
2017-12-06 03:32:33 +00:00
|
|
|
|
|
|
|
if (id) {
|
|
|
|
Out_Error out;
|
|
|
|
out.id = *id;
|
2017-12-31 03:18:33 +00:00
|
|
|
if (indexing) {
|
|
|
|
out.error.code = lsErrorCodes::ServerNotInitialized;
|
|
|
|
out.error.message = absolute_path + " is being indexed.";
|
|
|
|
} else {
|
|
|
|
out.error.code = lsErrorCodes::InternalError;
|
|
|
|
out.error.message = "Unable to find file " + absolute_path;
|
|
|
|
}
|
2018-05-28 00:50:02 +00:00
|
|
|
pipeline::WriteStdout(kMethodType_Unknown, out);
|
2017-12-06 03:32:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-07-06 00:53:33 +00:00
|
|
|
void EmitSkippedRanges(WorkingFile *working_file,
|
|
|
|
const std::vector<Range> &skipped_ranges) {
|
2018-07-08 19:49:27 +00:00
|
|
|
Out_CclsSetSkippedRanges out;
|
2017-12-06 03:32:33 +00:00
|
|
|
out.params.uri = lsDocumentUri::FromPath(working_file->filename);
|
2018-07-06 00:53:33 +00:00
|
|
|
for (Range skipped : skipped_ranges) {
|
2018-03-31 03:16:33 +00:00
|
|
|
std::optional<lsRange> ls_skipped = GetLsRange(working_file, skipped);
|
2017-12-06 03:32:33 +00:00
|
|
|
if (ls_skipped)
|
2018-07-08 19:49:27 +00:00
|
|
|
out.params.skippedRanges.push_back(*ls_skipped);
|
2017-12-06 03:32:33 +00:00
|
|
|
}
|
2018-07-08 19:49:27 +00:00
|
|
|
pipeline::WriteStdout(kMethodType_CclsPublishSkippedRanges, out);
|
2017-12-06 03:32:33 +00:00
|
|
|
}
|
|
|
|
|
2018-07-09 02:56:33 +00:00
|
|
|
void EmitSemanticHighlighting(DB *db,
|
|
|
|
SemanticHighlightSymbolCache *semantic_cache,
|
|
|
|
WorkingFile *wfile, QueryFile *file) {
|
2017-12-06 03:32:33 +00:00
|
|
|
assert(file->def);
|
2018-06-01 21:22:55 +00:00
|
|
|
if (wfile->buffer_content.size() > g_config->largeFileSize ||
|
|
|
|
!semantic_cache->match_->IsMatch(file->def->path))
|
2018-03-09 08:23:32 +00:00
|
|
|
return;
|
2017-12-06 03:32:33 +00:00
|
|
|
auto semantic_cache_for_file =
|
|
|
|
semantic_cache->GetCacheForFile(file->def->path);
|
|
|
|
|
|
|
|
// Group symbols together.
|
2018-03-31 03:16:33 +00:00
|
|
|
std::unordered_map<SymbolIdx, Out_CclsPublishSemanticHighlighting::Symbol>
|
2017-12-06 03:32:33 +00:00
|
|
|
grouped_symbols;
|
|
|
|
for (SymbolRef sym : file->def->all_symbols) {
|
2018-01-31 04:59:31 +00:00
|
|
|
std::string_view detailed_name;
|
2018-03-07 08:29:53 +00:00
|
|
|
lsSymbolKind parent_kind = lsSymbolKind::Unknown;
|
2018-02-18 19:29:38 +00:00
|
|
|
lsSymbolKind kind = lsSymbolKind::Unknown;
|
2018-06-01 21:22:55 +00:00
|
|
|
StorageClass storage = SC_None;
|
2017-12-06 03:32:33 +00:00
|
|
|
// This switch statement also filters out symbols that are not highlighted.
|
2018-02-09 17:42:10 +00:00
|
|
|
switch (sym.kind) {
|
2018-07-09 02:56:33 +00:00
|
|
|
case SymbolKind::Func: {
|
|
|
|
const QueryFunc &func = db->GetFunc(sym);
|
|
|
|
const QueryFunc::Def *def = func.AnyDef();
|
|
|
|
if (!def)
|
|
|
|
continue; // applies to for loop
|
|
|
|
if (def->spell)
|
|
|
|
parent_kind = GetSymbolKind(db, *def->spell);
|
|
|
|
if (parent_kind == lsSymbolKind::Unknown) {
|
|
|
|
for (Use use : func.declarations) {
|
|
|
|
parent_kind = GetSymbolKind(db, use);
|
|
|
|
break;
|
2018-03-07 08:56:47 +00:00
|
|
|
}
|
2017-12-06 03:32:33 +00:00
|
|
|
}
|
2018-07-09 02:56:33 +00:00
|
|
|
// Don't highlight overloadable operators or implicit lambda ->
|
|
|
|
// std::function constructor.
|
|
|
|
std::string_view short_name = def->Name(false);
|
|
|
|
if (short_name.compare(0, 8, "operator") == 0)
|
|
|
|
continue; // applies to for loop
|
|
|
|
if (def->spell)
|
|
|
|
parent_kind = GetSymbolKind(db, *def->spell);
|
|
|
|
kind = def->kind;
|
|
|
|
storage = def->storage;
|
|
|
|
detailed_name = short_name;
|
|
|
|
|
|
|
|
// Check whether the function name is actually there.
|
|
|
|
// If not, do not publish the semantic highlight.
|
|
|
|
// E.g. copy-initialization of constructors should not be highlighted
|
|
|
|
// but we still want to keep the range for jumping to definition.
|
|
|
|
std::string_view concise_name =
|
|
|
|
detailed_name.substr(0, detailed_name.find('<'));
|
|
|
|
int16_t start_line = sym.range.start.line;
|
|
|
|
int16_t start_col = sym.range.start.column;
|
|
|
|
if (start_line < 0 || start_line >= wfile->index_lines.size())
|
|
|
|
continue;
|
|
|
|
std::string_view line = wfile->index_lines[start_line];
|
|
|
|
sym.range.end.line = start_line;
|
|
|
|
if (!(start_col + concise_name.size() <= line.size() &&
|
|
|
|
line.compare(start_col, concise_name.size(), concise_name) == 0))
|
|
|
|
continue;
|
|
|
|
sym.range.end.column = start_col + concise_name.size();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case SymbolKind::Type:
|
|
|
|
for (auto &def : db->GetType(sym).def) {
|
|
|
|
kind = def.kind;
|
|
|
|
detailed_name = def.detailed_name;
|
|
|
|
if (def.spell) {
|
|
|
|
parent_kind = GetSymbolKind(db, *def.spell);
|
|
|
|
break;
|
2018-02-18 05:52:14 +00:00
|
|
|
}
|
2018-07-09 02:56:33 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SymbolKind::Var: {
|
|
|
|
const QueryVar &var = db->GetVar(sym);
|
|
|
|
for (auto &def : var.def) {
|
|
|
|
kind = def.kind;
|
|
|
|
storage = def.storage;
|
|
|
|
detailed_name = def.detailed_name;
|
|
|
|
if (def.spell) {
|
|
|
|
parent_kind = GetSymbolKind(db, *def.spell);
|
|
|
|
break;
|
2018-02-18 05:52:14 +00:00
|
|
|
}
|
2018-07-09 02:56:33 +00:00
|
|
|
}
|
|
|
|
if (parent_kind == lsSymbolKind::Unknown) {
|
|
|
|
for (Use use : var.declarations) {
|
|
|
|
parent_kind = GetSymbolKind(db, use);
|
|
|
|
break;
|
2018-03-07 08:56:47 +00:00
|
|
|
}
|
|
|
|
}
|
2018-07-09 02:56:33 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
continue; // applies to for loop
|
2017-12-06 03:32:33 +00:00
|
|
|
}
|
|
|
|
|
2018-06-01 21:22:55 +00:00
|
|
|
std::optional<lsRange> loc = GetLsRange(wfile, sym.range);
|
2017-12-06 03:32:33 +00:00
|
|
|
if (loc) {
|
2018-02-11 18:25:37 +00:00
|
|
|
auto it = grouped_symbols.find(sym);
|
2017-12-06 03:32:33 +00:00
|
|
|
if (it != grouped_symbols.end()) {
|
2018-07-09 02:56:33 +00:00
|
|
|
it->second.lsRanges.push_back(*loc);
|
2017-12-06 03:32:33 +00:00
|
|
|
} else {
|
2018-03-31 03:16:33 +00:00
|
|
|
Out_CclsPublishSemanticHighlighting::Symbol symbol;
|
2018-01-31 04:59:31 +00:00
|
|
|
symbol.stableId = semantic_cache_for_file->GetStableId(
|
2018-02-09 17:42:10 +00:00
|
|
|
sym.kind, std::string(detailed_name));
|
2018-01-28 20:34:31 +00:00
|
|
|
symbol.parentKind = parent_kind;
|
2018-01-17 01:48:22 +00:00
|
|
|
symbol.kind = kind;
|
2018-01-26 17:28:29 +00:00
|
|
|
symbol.storage = storage;
|
2018-07-09 02:56:33 +00:00
|
|
|
symbol.lsRanges.push_back(*loc);
|
2018-02-11 18:25:37 +00:00
|
|
|
grouped_symbols[sym] = symbol;
|
2017-12-06 03:32:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-01-10 03:04:08 +00:00
|
|
|
// Make ranges non-overlapping using a scan line algorithm.
|
|
|
|
std::vector<ScanLineEvent> events;
|
|
|
|
int id = 0;
|
2018-07-09 02:56:33 +00:00
|
|
|
for (auto &entry : grouped_symbols) {
|
|
|
|
Out_CclsPublishSemanticHighlighting::Symbol &symbol = entry.second;
|
|
|
|
for (auto &loc : symbol.lsRanges) {
|
2018-01-11 02:43:01 +00:00
|
|
|
// For ranges sharing the same start point, the one with leftmost end
|
|
|
|
// point comes first.
|
2018-01-10 03:04:08 +00:00
|
|
|
events.push_back({loc.start, loc.end, id, &symbol});
|
|
|
|
// For ranges sharing the same end point, their relative order does not
|
|
|
|
// matter, therefore we arbitrarily assign loc.end to them. We use
|
|
|
|
// negative id to indicate a deletion event.
|
|
|
|
events.push_back({loc.end, loc.end, ~id, &symbol});
|
|
|
|
id++;
|
|
|
|
}
|
2018-07-09 02:56:33 +00:00
|
|
|
symbol.lsRanges.clear();
|
2018-01-10 03:04:08 +00:00
|
|
|
}
|
|
|
|
std::sort(events.begin(), events.end());
|
|
|
|
|
|
|
|
std::vector<uint8_t> deleted(id, 0);
|
|
|
|
int top = 0;
|
|
|
|
for (size_t i = 0; i < events.size(); i++) {
|
|
|
|
while (top && deleted[events[top - 1].id])
|
|
|
|
top--;
|
|
|
|
// Order [a, b0) after [a, b1) if b0 < b1. The range comes later overrides
|
|
|
|
// the ealier. The order of [a0, b) [a1, b) does not matter.
|
|
|
|
// The order of [a, b) [b, c) does not as long as we do not emit empty
|
|
|
|
// ranges.
|
2018-01-11 02:43:01 +00:00
|
|
|
// Attribute range [events[i-1].pos, events[i].pos) to events[top-1].symbol
|
|
|
|
// .
|
2018-01-10 03:04:08 +00:00
|
|
|
if (top && !(events[i - 1].pos == events[i].pos))
|
2018-07-09 02:56:33 +00:00
|
|
|
events[top - 1].symbol->lsRanges.push_back(
|
|
|
|
{events[i - 1].pos, events[i].pos});
|
2018-01-10 03:04:08 +00:00
|
|
|
if (events[i].id >= 0)
|
|
|
|
events[top++] = events[i];
|
|
|
|
else
|
|
|
|
deleted[~events[i].id] = 1;
|
|
|
|
}
|
|
|
|
|
2018-03-31 03:16:33 +00:00
|
|
|
Out_CclsPublishSemanticHighlighting out;
|
2018-06-01 21:22:55 +00:00
|
|
|
out.params.uri = lsDocumentUri::FromPath(wfile->filename);
|
2018-07-09 02:56:33 +00:00
|
|
|
// Transform lsRange into pair<int, int> (offset pairs)
|
|
|
|
{
|
|
|
|
std::vector<std::pair<lsRange, Out_CclsPublishSemanticHighlighting::Symbol *>>
|
|
|
|
scratch;
|
|
|
|
for (auto &entry : grouped_symbols)
|
|
|
|
for (auto &range : entry.second.lsRanges)
|
|
|
|
scratch.emplace_back(range, &entry.second);
|
|
|
|
std::sort(scratch.begin(), scratch.end(),
|
|
|
|
[](auto &l, auto &r) { return l.first.start < r.first.start; });
|
|
|
|
const auto &buf = wfile->buffer_content;
|
|
|
|
int l = 0, c = 0, i = 0;
|
|
|
|
auto mov = [&](int line, int col) {
|
|
|
|
if (l < line)
|
|
|
|
c = 0;
|
|
|
|
for (; l < line && i < buf.size(); i++)
|
|
|
|
if (buf[i] == '\n')
|
|
|
|
l++;
|
|
|
|
if (l < line) return true;
|
|
|
|
for (; c < col && i < buf.size(); c++)
|
|
|
|
if (uint8_t(buf[i++]) >= 128)
|
|
|
|
// Skip 0b10xxxxxx
|
|
|
|
while (i < buf.size() && uint8_t(buf[i]) >= 128 && uint8_t(buf[i]) < 192)
|
|
|
|
i++;
|
|
|
|
return c < col;
|
|
|
|
};
|
|
|
|
for (auto &entry : scratch) {
|
|
|
|
lsRange &r = entry.first;
|
|
|
|
if (mov(r.start.line, r.start.character))
|
|
|
|
continue;
|
|
|
|
int beg = i;
|
|
|
|
if (mov(r.end.line, r.end.character))
|
|
|
|
continue;
|
|
|
|
entry.second->ranges.emplace_back(beg, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto &entry : grouped_symbols)
|
2018-01-10 03:04:08 +00:00
|
|
|
if (entry.second.ranges.size())
|
2018-07-09 02:56:33 +00:00
|
|
|
out.params.symbols.push_back(std::move(entry.second));
|
2018-05-28 00:50:02 +00:00
|
|
|
pipeline::WriteStdout(kMethodType_CclsPublishSemanticHighlighting, out);
|
2017-12-07 01:00:19 +00:00
|
|
|
}
|