Skip to content

Commit

Permalink
Show truncation tooltip if label is raw string
Browse files Browse the repository at this point in the history
  • Loading branch information
bivashy committed Sep 22, 2024
1 parent 1ba72a6 commit 1c313b5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugin/inlay_hint.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui
})
result += f'<a href="{inlay_hint_click_command}">'
instruction_text = '\nDouble-click to insert' if has_text_edits else ""
truncated_label = label[:truncate_limit] + '…' if len(label) > truncate_limit else label
result += f'<span title="{(tooltip + instruction_text).strip()}">{html.escape(truncated_label)}</span>'
truncated = len(label) > truncate_limit
truncated_label = label[:truncate_limit] + '…' if truncated else label
tooltip_label = "".join(label_part['value'] for label_part in label)
truncation_tooltip = html.escape('\n' + tooltip_label) if truncated else ""
result += f'<span title="{(tooltip + instruction_text + truncation_tooltip).strip()}">{html.escape(truncated_label)}</span>'
if is_clickable:
result += "</a>"
return result
Expand Down

0 comments on commit 1c313b5

Please sign in to comment.