getDocumentHighlight method

Future<List> getDocumentHighlight(
  1. String filePath,
  2. int line,
  3. int character
)

Gets all highlights for a symbol at the specified position in the document.

Returns a list of DocumentHighlight objects, each containing a range and highlight kind. Used for highlighting all occurrences of a symbol when clicked.

Implementation

Future<List<dynamic>> getDocumentHighlight(
  String filePath,
  int line,
  int character,
) async {
  if (!capabilities.documentHighlight) return [];
  final response = await _sendRequest(
    method: 'textDocument/documentHighlight',
    params: _commonParams(filePath, line, character),
  );

  final result = response['result'];
  if (result is! List) return [];
  return result;
}