openDocument method
Opens the document in the LSP server.
This method is used internally by the CodeCrafter widget and calling it directly is not recommended.
Implementation
Future<void> openDocument() async {
final version = (_openDocuments[filePath] ?? 0) + 1;
_openDocuments[filePath] = version;
final String text = await File(filePath).readAsString();
await _sendNotification(
method: 'textDocument/didOpen',
params: {
'textDocument': {
'uri': Uri.file(filePath).toString(),
'languageId': languageId,
'version': version,
'text': text,
},
},
);
await Future.delayed(Duration(milliseconds: 300));
}