getColorPresentation method
Implementation
Future<Map<String, dynamic>> getColorPresentation(
String filePath, {
required double red,
required double blue,
required double green,
required double alpha,
required Map<String, dynamic> range,
}) async {
if (!capabilities.documentColor) return {'result': []};
/// Requests color presentation(s) for a color at a given range.
///
/// Sends a `textDocument/colorPresentation` request to the language server
/// for the document at [filePath]. The [red], [green], [blue], and [alpha]
/// values should be in the 0.0..1.0 range. [range] is a LSP range map
/// (with `start`/`end` positions) that identifies where the color appears
/// in the document. Returns the raw server response as a map; callers
/// should inspect `response['result']` according to the server's
/// specification for color presentations.
final response = await _sendRequest(
method: "textDocument/colorPresentation",
params: {
'textDocument': {'uri': Uri.file(filePath).toString()},
'color': {'red': red, 'blue': blue, 'green': green, 'alpha': alpha},
'range': range,
},
);
return response;
}