syncSyntaxAsync<State> method
Future<TextSyntaxSnapshot<State> ?>
syncSyntaxAsync<State>(
- AsyncTextSyntaxSession<
State> session, { - String? language,
- bool force = false,
Asynchronously synchronizes syntax without publishing stale results.
The session rejects results superseded by a newer request. This method additionally verifies that the textarea still contains the requested document before updating its syntax decoration layer.
Implementation
Future<TextSyntaxSnapshot<State>?> syncSyntaxAsync<State>(
AsyncTextSyntaxSession<State> session, {
String? language,
bool force = false,
}) async {
_refreshDocumentSnapshot();
final requestedDocument = _document;
final snapshot = await session.request(
requestedDocument,
language: language,
force: force,
change: _lastDocumentChange,
);
if (snapshot == null) return null;
_refreshDocumentSnapshot();
if (_document.text != requestedDocument.text) return null;
setDecorationLayer(
textSyntaxDecorationLayerKey,
snapshot.decorations,
priority: textSyntaxDecorationLayerPriority,
);
return snapshot;
}