@ -846,29 +846,39 @@ void Source::LanguageProtocolView::setup_navigation_and_refactoring() {
std : : promise < void > result_processed ;
std : : promise < void > result_processed ;
client - > write_request ( this , " textDocument/documentSymbol " , R " ( " textDocument " :{ " uri " : " ) " + uri + " \ " } " , [ & result_processed , & methods ] ( const boost : : property_tree : : ptree & result , bool error ) {
client - > write_request ( this , " textDocument/documentSymbol " , R " ( " textDocument " :{ " uri " : " ) " + uri + " \ " } " , [ & result_processed , & methods ] ( const boost : : property_tree : : ptree & result , bool error ) {
if ( ! error ) {
if ( ! error ) {
for ( auto it = result . begin ( ) ; it ! = result . end ( ) ; + + it ) {
std : : function < void ( const boost : : property_tree : : ptree & ptee , const std : : string & container ) > parse_result = [ & methods , & parse_result ] ( const boost : : property_tree : : ptree & pt , const std : : string & container ) {
try {
for ( auto it = pt . begin ( ) ; it ! = pt . end ( ) ; + + it ) {
auto kind = it - > second . get < int > ( " kind " ) ;
try {
if ( kind = = 6 | | kind = = 9 | | kind = = 12 ) {
auto kind = it - > second . get < int > ( " kind " ) ;
std : : unique_ptr < LanguageProtocol : : Range > range ;
if ( kind = = 6 | | kind = = 9 | | kind = = 12 ) {
std : : string container ;
std : : unique_ptr < LanguageProtocol : : Range > range ;
auto location_pt = it - > second . get_child_optional ( " location " ) ;
std : : string prefix ;
if ( location_pt ) {
auto location_pt = it - > second . get_child_optional ( " location " ) ;
LanguageProtocol : : Location location ( * location_pt ) ;
if ( location_pt ) {
container = it - > second . get < std : : string > ( " containerName " , " " ) ;
LanguageProtocol : : Location location ( * location_pt ) ;
if ( container = = " null " )
range = std : : make_unique < LanguageProtocol : : Range > ( location . range ) ;
container . clear ( ) ;
std : : string container = it - > second . get < std : : string > ( " containerName " , " " ) ;
range = std : : make_unique < LanguageProtocol : : Range > ( location . range ) ;
if ( container = = " null " )
container . clear ( ) ;
if ( ! container . empty ( ) )
prefix = container + " :: " ;
}
else {
range = std : : make_unique < LanguageProtocol : : Range > ( it - > second . get_child ( " range " ) ) ;
if ( ! container . empty ( ) )
prefix = container + " :: " ;
}
methods . emplace_back ( Offset ( range - > start . line , range - > start . character ) , std : : to_string ( range - > start . line + 1 ) + " : " + prefix + " <b> " + it - > second . get < std : : string > ( " name " ) + " </b> " ) ;
}
}
else
auto children = it - > second . get_child_optional ( " children " ) ;
range = std : : make_unique < LanguageProtocol : : Range > ( it - > second . get_child ( " range " ) ) ;
if ( children )
parse_result ( * children , ( ! container . empty ( ) ? container + " :: " : " " ) + it - > second . get < std : : string > ( " name " ) ) ;
methods . emplace_back ( Offset ( range - > start . line , range - > start . character ) , std : : to_string ( range - > start . line + 1 ) + " : " + ( ! container . empty ( ) ? container + " :: " : " " ) + " <b> " + it - > second . get < std : : string > ( " name " ) + " </b> " ) ;
}
catch ( . . . ) {
}
}
}
}
catch ( . . . ) {
} ;
}
parse_result ( result , " " ) ;
}
}
}
result_processed . set_value ( ) ;
result_processed . set_value ( ) ;
} ) ;
} ) ;