formatDocument method
Formats the entire document according to server rules.
Returns a list of text edits to apply to the document.
Implementation
Future<List<dynamic>> formatDocument(String filePath) async {
final response = await _sendRequest(
method: 'textDocument/formatting',
params: {
'textDocument': {'uri': Uri.file(filePath).toString()},
'options': {'tabSize': 2, 'insertSpaces': true},
},
);
final result = response['result'];
if (result is! List) return [];
return result;
}