formatHoverResult function

String formatHoverResult(
  1. LspHover? hover, {
  2. String? cwd,
})

Format hover result.

Implementation

String formatHoverResult(LspHover? hover, {String? cwd}) {
  if (hover == null) {
    return 'No hover information available. This may occur if the cursor is '
        'not on a symbol, or if the LSP server has not fully indexed the file.';
  }
  final content = extractMarkupText(hover.contents);
  if (hover.range != null) {
    final line = hover.range!.start.line + 1;
    final character = hover.range!.start.character + 1;
    return 'Hover info at $line:$character:\n\n$content';
  }
  return content;
}