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.
initialContent must be provided as the document content since file reading is not supported on web.
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));
}