mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-08-18 06:55:48 +03:00
Fix crash on LSP reload.
Fix document symbols not being sorted (some LSPs do not sort the symbols for some reason). Update efsw.
This commit is contained in:
@@ -428,6 +428,16 @@ struct LSPSymbolInformationTmp {
|
||||
}
|
||||
};
|
||||
|
||||
static void sortRecursive( std::list<LSPSymbolInformationTmp>& symbols ) {
|
||||
symbols.sort( []( const LSPSymbolInformationTmp& left, const LSPSymbolInformationTmp& right ) {
|
||||
return left.range < right.range;
|
||||
} );
|
||||
|
||||
for ( auto& symbol : symbols )
|
||||
if ( !symbol.children.empty() )
|
||||
sortRecursive( symbol.children );
|
||||
}
|
||||
|
||||
static LSPSymbolInformationList parseDocumentSymbols( const json& result, bool isSilent ) {
|
||||
// TODO: Optimize this
|
||||
Clock clock;
|
||||
@@ -482,6 +492,8 @@ static LSPSymbolInformationList parseDocumentSymbols( const json& result, bool i
|
||||
for ( const auto& info : symInfos )
|
||||
parseSymbol( info, nullptr );
|
||||
|
||||
sortRecursive( ret );
|
||||
|
||||
LSPSymbolInformationList rret;
|
||||
for ( const auto& r : ret )
|
||||
rret.push_back( LSPSymbolInformationTmp::fromTmp( r ) );
|
||||
|
||||
Reference in New Issue
Block a user