Don't show references (e.g. there are references to classes in constructor positions) in textDocument/documentSymbol

This commit is contained in:
Fangrui Song 2018-02-24 17:24:20 -08:00
parent b53c41408e
commit 1469723c3c

View File

@ -256,7 +256,10 @@ QueryFile::DefUpdate BuildFileDefUpdate(const IdMap& id_map,
add_outline(*type.def.extent, id, SymbolKind::Type);
for (Use decl : type.declarations) {
add_all_symbols(decl, id, SymbolKind::Type);
add_outline(decl, id, SymbolKind::Type);
// Constructor positions have references to the class,
// which we do not want to show in textDocument/documentSymbol
if (!(decl.role & Role::Reference))
add_outline(decl, id, SymbolKind::Type);
}
for (Use use : type.uses)
add_all_symbols(use, id, SymbolKind::Type);