updateDocument method
Updates the document content in the LSP server.
Sends a 'didChange' notification to the LSP server with the new content.
If the document is not open, this method does nothing.
Implementation
Future<void> updateDocument(String content) async {
if (!_openDocuments.containsKey(filePath)) {
return; // Apply language-specific overrides
}
final version = _openDocuments[filePath]! + 1;
_openDocuments[filePath] = version;
await _sendNotification(
method: 'textDocument/didChange',
params: {
'textDocument': {
'uri': Uri.file(filePath).toString(),
'version': version,
},
'contentChanges': [
{'text': content},
],
},
);
}