From 6335b74522c5de8803f2c0349a45fe62392fd5b0 Mon Sep 17 00:00:00 2001 From: bivashy Date: Tue, 17 Sep 2024 20:20:48 +0500 Subject: [PATCH] Do not modify method variable, use local variable instead --- plugin/inlay_hint.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index bc7a99c2b..5ba195522 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -149,8 +149,9 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui result += "" return result + remaining_truncate_limit = truncate_limit for label_part in label: - if truncate_limit <= 0: + if remaining_truncate_limit <= 0: break value = "" tooltip = format_inlay_hint_tooltip(label_part.get("tooltip")) @@ -167,8 +168,8 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui }) value += f'' raw_label = label_part['value'] - truncated_label = raw_label[:truncate_limit] + '...' if len(raw_label) >= truncate_limit else raw_label - truncate_limit -= len(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: value += ""