mirror of
https://github.com/MaskRay/ccls.git
synced 2025-06-08 01:04:54 +00:00
Hide all function declarations in documentSymbol.
This commit is contained in:
parent
5e15f51681
commit
317a9b793e
@ -45,7 +45,7 @@ using Usr = uint64_t;
|
|||||||
|
|
||||||
// The order matters. In FindSymbolsAtLocation, we want Var/Func ordered in
|
// The order matters. In FindSymbolsAtLocation, we want Var/Func ordered in
|
||||||
// front of others.
|
// front of others.
|
||||||
enum class Kind : uint8_t { Invalid, File, Type, Func, Var };
|
enum class Kind : uint8_t { Invalid, File, Type, Func, FuncDecl, Var };
|
||||||
REFLECT_UNDERLYING_B(Kind);
|
REFLECT_UNDERLYING_B(Kind);
|
||||||
|
|
||||||
enum class Role : uint16_t {
|
enum class Role : uint16_t {
|
||||||
|
@ -182,6 +182,9 @@ void MessageHandler::textDocument_documentSymbol(JsonReader &reader,
|
|||||||
for (auto [sym, refcnt] : file->symbol2refcnt) {
|
for (auto [sym, refcnt] : file->symbol2refcnt) {
|
||||||
if (refcnt <= 0 || !sym.extent.Valid())
|
if (refcnt <= 0 || !sym.extent.Valid())
|
||||||
continue;
|
continue;
|
||||||
|
// For now we do not show function decl because there can be multiple items.
|
||||||
|
if (sym.kind == Kind::FuncDecl)
|
||||||
|
continue;
|
||||||
auto r = sym2ds.try_emplace(SymbolIdx{sym.usr, sym.kind});
|
auto r = sym2ds.try_emplace(SymbolIdx{sym.usr, sym.kind});
|
||||||
if (!r.second)
|
if (!r.second)
|
||||||
continue;
|
continue;
|
||||||
|
@ -310,9 +310,9 @@ void DB::ApplyIndexUpdate(IndexUpdate *u) {
|
|||||||
Update(lid2file_id, u->file_id, std::move(u->funcs_def_update));
|
Update(lid2file_id, u->file_id, std::move(u->funcs_def_update));
|
||||||
for (auto &[usr, del_add]: u->funcs_declarations) {
|
for (auto &[usr, del_add]: u->funcs_declarations) {
|
||||||
for (DeclRef &dr : del_add.first)
|
for (DeclRef &dr : del_add.first)
|
||||||
RefDecl(prev_lid2file_id, usr, Kind::Func, dr, -1);
|
RefDecl(prev_lid2file_id, usr, Kind::FuncDecl, dr, -1);
|
||||||
for (DeclRef &dr : del_add.second)
|
for (DeclRef &dr : del_add.second)
|
||||||
RefDecl(lid2file_id, usr, Kind::Func, dr, 1);
|
RefDecl(lid2file_id, usr, Kind::FuncDecl, dr, 1);
|
||||||
}
|
}
|
||||||
REMOVE_ADD(func, declarations);
|
REMOVE_ADD(func, declarations);
|
||||||
REMOVE_ADD(func, derived);
|
REMOVE_ADD(func, derived);
|
||||||
|
Loading…
Reference in New Issue
Block a user