getDocumentSymbols method

Future<List> getDocumentSymbols(
  1. String filePath
)

Retrieves all symbols defined in the current document.

This is used for outline views, breadcrumbs, and file structure panels. Returns either a hierarchical or flat symbol list depending on server support.

Implementation

Future<List<dynamic>> getDocumentSymbols(String filePath) async {
  final response = await _sendRequest(
    method: 'textDocument/documentSymbol',
    params: {
      'textDocument': {'uri': Uri.file(filePath).toString()},
    },
  );

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