diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 5ba195522..1c1c43bbb 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -143,7 +143,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui }) result += f'' instruction_text = '\nDouble-click to insert' if has_text_edits else "" - truncated_label = label[:truncate_limit] + '...' if len(label) >= truncate_limit else label + truncated_label = label[:truncate_limit] + '...' if len(label) > truncate_limit else label result += f'{html.escape(truncated_label)}' if is_clickable: result += "" @@ -151,7 +151,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui remaining_truncate_limit = truncate_limit for label_part in label: - if remaining_truncate_limit <= 0: + if remaining_truncate_limit < 0: break value = "" tooltip = format_inlay_hint_tooltip(label_part.get("tooltip")) @@ -168,7 +168,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui }) value += f'' raw_label = label_part['value'] - truncated_label = raw_label[:remaining_truncate_limit] + '...' if len(raw_label) >= remaining_truncate_limit else raw_label + truncated_label = raw_label[:remaining_truncate_limit] + '...' if len(raw_label) > remaining_truncate_limit else raw_label remaining_truncate_limit -= len(raw_label) value += html.escape(truncated_label) if has_command: