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