Skip to content

Commit

Permalink
Do not modify method variable, use local variable instead
Browse files Browse the repository at this point in the history
  • Loading branch information
bivashy committed Sep 17, 2024
1 parent 528a430 commit 6335b74
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions plugin/inlay_hint.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui
result += "</a>"
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"))
Expand All @@ -167,8 +168,8 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui
})
value += f'<a href="{inlay_hint_click_command}">'
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 += "</a>"
Expand Down

0 comments on commit 6335b74

Please sign in to comment.