FoldRangeProvider is now an interface.

Fix rare crash in linter plugin.
This commit is contained in:
Martín Lucas Golini
2024-07-11 20:04:47 -03:00
parent 2e0c89d82a
commit a836f6335e
5 changed files with 25 additions and 14 deletions

View File

@@ -30,9 +30,7 @@ void LSPDocumentClient::onServerInitialized() {
}
void LSPDocumentClient::setupFoldRangeService() {
mDoc->getFoldRangeService().setProvider( [this]( auto, bool requestFolds ) -> bool {
return tryRequestFoldRanges( requestFolds );
} );
mDoc->getFoldRangeService().setProvider( this );
if ( mDoc->getFoldRangeService().isEnabled() )
tryRequestFoldRanges( true );
}
@@ -57,6 +55,10 @@ bool LSPDocumentClient::tryRequestFoldRanges( bool requestFolds ) {
return ret;
}
bool LSPDocumentClient::foldingRangeProvider() const {
return mServer->getCapabilities().foldingRangeProvider;
}
void LSPDocumentClient::onDocumentLoaded( TextDocument* ) {
refreshTag();
requestSemanticHighlightingDelayed();