From 1469723c3c66b7b3feadd72001381238f2ac1461 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 24 Feb 2018 17:24:20 -0800 Subject: [PATCH] Don't show references (e.g. there are references to classes in constructor positions) in textDocument/documentSymbol --- src/query.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/query.cc b/src/query.cc index c6d71180..9f67a178 100644 --- a/src/query.cc +++ b/src/query.cc @@ -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);