From 1d85bcc80066e475d5201ea3ae13538ad7391c67 Mon Sep 17 00:00:00 2001 From: bivashy Date: Sun, 15 Sep 2024 23:26:54 +0500 Subject: [PATCH 01/32] Truncate inlay hint label --- plugin/core/types.py | 2 ++ plugin/inlay_hint.py | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plugin/core/types.py b/plugin/core/types.py index 46d7efa7b..f4717b604 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -227,6 +227,7 @@ class Settings: show_code_actions = cast(str, None) show_code_lens = cast(str, None) show_inlay_hints = cast(bool, None) + inlay_truncate_limit = cast(int, None) show_diagnostics_in_hover = cast(bool, None) show_code_actions_in_hover = cast(bool, None) show_diagnostics_annotations_severity_level = cast(int, None) @@ -272,6 +273,7 @@ def r(name: str, default: bool | int | str | list | dict) -> None: r("show_code_actions", "annotation") r("show_code_lens", "annotation") r("show_inlay_hints", False) + r("inlay_truncate_limit", 1000) r("show_diagnostics_in_hover", True) r("show_code_actions_in_hover", True) r("show_diagnostics_annotations_severity_level", 0) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 819e7a2b8..594d2eca6 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -97,7 +97,7 @@ def inlay_hint_to_phantom(view: sublime.View, inlay_hint: InlayHint, session: Se def get_inlay_hint_html(view: sublime.View, inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: - label = format_inlay_hint_label(inlay_hint, session, phantom_uuid) + label = format_inlay_hint_label(inlay_hint, session, phantom_uuid, view.settings().get("inlay_truncate_limit", userprefs().inlay_truncate_limit)) font = view.settings().get('font_face') or "monospace" html = f""" @@ -123,7 +123,7 @@ def format_inlay_hint_tooltip(tooltip: str | MarkupContent | None) -> str: return "" -def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: +def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uuid: str, truncate_limit: int) -> str: tooltip = format_inlay_hint_tooltip(inlay_hint.get("tooltip")) result = "" can_resolve_inlay_hint = session.has_capability('inlayHintProvider.resolveProvider') @@ -142,12 +142,15 @@ 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 "" - result += f'{html.escape(label)}' + truncated_label = label[:truncate_limit] + '...' if len(label) > truncate_limit else label + result += f'{html.escape(truncated_label)}' if is_clickable: result += "" return result for label_part in label: + if truncate_limit <= 0: + break value = "" tooltip = format_inlay_hint_tooltip(label_part.get("tooltip")) has_command = bool(label_part.get('command')) @@ -162,7 +165,10 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui } }) value += f'' - value += html.escape(label_part['value']) + 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) + value += html.escape(truncated_label) if has_command: value += "" # InlayHintLabelPart.location is not supported From 41150db25a09a87f49588ce07624bf6ba2941b8c Mon Sep 17 00:00:00 2001 From: bivashy Date: Sun, 15 Sep 2024 23:49:10 +0500 Subject: [PATCH 02/32] Split long line into multiple lines --- plugin/inlay_hint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 594d2eca6..24834edc1 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -97,7 +97,8 @@ def inlay_hint_to_phantom(view: sublime.View, inlay_hint: InlayHint, session: Se def get_inlay_hint_html(view: sublime.View, inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: - label = format_inlay_hint_label(inlay_hint, session, phantom_uuid, view.settings().get("inlay_truncate_limit", userprefs().inlay_truncate_limit)) + truncate_limit = view.settings().get("inlay_truncate_limit", userprefs().inlay_truncate_limit) + label = format_inlay_hint_label(inlay_hint, session, phantom_uuid, truncate_limit) font = view.settings().get('font_face') or "monospace" html = f""" From 0c9f49c95048e808e8eacd43c64ee32819308e75 Mon Sep 17 00:00:00 2001 From: bivashy Date: Mon, 16 Sep 2024 00:16:27 +0500 Subject: [PATCH 03/32] Add `inlay_truncate_limit` into settings --- LSP.sublime-settings | 3 +++ 1 file changed, 3 insertions(+) diff --git a/LSP.sublime-settings b/LSP.sublime-settings index 0bf0e6902..af81d951a 100644 --- a/LSP.sublime-settings +++ b/LSP.sublime-settings @@ -180,6 +180,9 @@ // or a custom keybinding. "show_inlay_hints": false, + // Truncate limit for inlay hints. Truncates and adds an ellipsis at the end. + "inlay_truncate_limit": 1000, + // Highlighting style of "highlights": accentuating nearby text entities that // are related to the one under your cursor. // Valid values are "background", "underline", "stippled", "outline", or "". From 9755ed2491798fa15e7cb9cfd503503efd0f6f58 Mon Sep 17 00:00:00 2001 From: bivashy Date: Mon, 16 Sep 2024 00:19:47 +0500 Subject: [PATCH 04/32] Add `inlay_truncate_limit` into sublime package --- sublime-package.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sublime-package.json b/sublime-package.json index 023541fe8..e4b5b5776 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -739,6 +739,12 @@ "default": false, "markdownDescription": "Show inlay hints in the editor. Inlay hints are short annotations within the code, which show variable types or parameter names.\nThis is the default value used for new windows but can be overriden per-window using the `LSP: Toggle Inlay Hints` command from the Command Palette, Main Menu or a custom keybinding." }, + "inlay_truncate_limit": { + "type": "integer", + "default": 1000, + "minimum": 0, + "markdownDescription": "Truncate limit for inlay hints. Truncates and adds an ellipsis at the end." + }, "initially_folded": { "type": "array", "items": { From 5c86172431381cd90ae3f3b1f407ae397012d103 Mon Sep 17 00:00:00 2001 From: bivashy Date: Mon, 16 Sep 2024 00:22:51 +0500 Subject: [PATCH 05/32] Fix missing ellipsis at specific cases --- plugin/inlay_hint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 24834edc1..65ff4fbe2 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 += "" @@ -167,7 +167,7 @@ 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 + truncated_label = raw_label[:truncate_limit] + '...' if len(raw_label) >= truncate_limit else raw_label truncate_limit -= len(raw_label) value += html.escape(truncated_label) if has_command: From 528a43071c4d24d566fc9b251fcd77b05a39a88b Mon Sep 17 00:00:00 2001 From: bivashy Date: Tue, 17 Sep 2024 20:05:37 +0500 Subject: [PATCH 06/32] Rename property `inlay_truncate_limit` into `inlay_hints_truncate_limit` --- LSP.sublime-settings | 2 +- plugin/core/types.py | 4 ++-- plugin/inlay_hint.py | 2 +- sublime-package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/LSP.sublime-settings b/LSP.sublime-settings index af81d951a..d66ff6629 100644 --- a/LSP.sublime-settings +++ b/LSP.sublime-settings @@ -181,7 +181,7 @@ "show_inlay_hints": false, // Truncate limit for inlay hints. Truncates and adds an ellipsis at the end. - "inlay_truncate_limit": 1000, + "inlay_hints_truncate_limit": 1000, // Highlighting style of "highlights": accentuating nearby text entities that // are related to the one under your cursor. diff --git a/plugin/core/types.py b/plugin/core/types.py index f4717b604..d7c2a09e8 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -227,7 +227,7 @@ class Settings: show_code_actions = cast(str, None) show_code_lens = cast(str, None) show_inlay_hints = cast(bool, None) - inlay_truncate_limit = cast(int, None) + inlay_hints_truncate_limit = cast(int, None) show_diagnostics_in_hover = cast(bool, None) show_code_actions_in_hover = cast(bool, None) show_diagnostics_annotations_severity_level = cast(int, None) @@ -273,7 +273,7 @@ def r(name: str, default: bool | int | str | list | dict) -> None: r("show_code_actions", "annotation") r("show_code_lens", "annotation") r("show_inlay_hints", False) - r("inlay_truncate_limit", 1000) + r("inlay_hints_truncate_limit", 1000) r("show_diagnostics_in_hover", True) r("show_code_actions_in_hover", True) r("show_diagnostics_annotations_severity_level", 0) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 65ff4fbe2..bc7a99c2b 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -97,7 +97,7 @@ def inlay_hint_to_phantom(view: sublime.View, inlay_hint: InlayHint, session: Se def get_inlay_hint_html(view: sublime.View, inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: - truncate_limit = view.settings().get("inlay_truncate_limit", userprefs().inlay_truncate_limit) + truncate_limit = view.settings().get("inlay_hints_truncate_limit", userprefs().inlay_hints_truncate_limit) label = format_inlay_hint_label(inlay_hint, session, phantom_uuid, truncate_limit) font = view.settings().get('font_face') or "monospace" html = f""" diff --git a/sublime-package.json b/sublime-package.json index e4b5b5776..79efa3d53 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -739,7 +739,7 @@ "default": false, "markdownDescription": "Show inlay hints in the editor. Inlay hints are short annotations within the code, which show variable types or parameter names.\nThis is the default value used for new windows but can be overriden per-window using the `LSP: Toggle Inlay Hints` command from the Command Palette, Main Menu or a custom keybinding." }, - "inlay_truncate_limit": { + "inlay_hints_truncate_limit": { "type": "integer", "default": 1000, "minimum": 0, From 6335b74522c5de8803f2c0349a45fe62392fd5b0 Mon Sep 17 00:00:00 2001 From: bivashy Date: Tue, 17 Sep 2024 20:20:48 +0500 Subject: [PATCH 07/32] 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 += "" From 8265c1bdb1b2308e63893b1178805176c13ef802 Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 19 Sep 2024 20:39:35 +0500 Subject: [PATCH 08/32] Make sure that truncation limit is exclusive --- plugin/inlay_hint.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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: From c43d722e6347224e5420c08c25187be70077c5b6 Mon Sep 17 00:00:00 2001 From: bivashy Date: Fri, 20 Sep 2024 00:23:50 +0500 Subject: [PATCH 09/32] Split long line into multiple lines --- plugin/inlay_hint.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 1c1c43bbb..ed7dbe342 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -168,7 +168,10 @@ 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 + if len(raw_label) > remaining_truncate_limit: + truncated_label = raw_label[:remaining_truncate_limit] + '...' + else: + truncated_label = raw_label remaining_truncate_limit -= len(raw_label) value += html.escape(truncated_label) if has_command: From a882902d5c5084d732774134e08f6e00437008f9 Mon Sep 17 00:00:00 2001 From: bivashy Date: Fri, 20 Sep 2024 00:30:17 +0500 Subject: [PATCH 10/32] Replace three dots with a compact character --- plugin/inlay_hint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index ed7dbe342..50c9e2e8f 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 += "" @@ -169,7 +169,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui value += f'' raw_label = label_part['value'] if len(raw_label) > remaining_truncate_limit: - truncated_label = raw_label[:remaining_truncate_limit] + '...' + truncated_label = raw_label[:remaining_truncate_limit] + '…' else: truncated_label = raw_label remaining_truncate_limit -= len(raw_label) From 808e8175db364c89172361161ba75e395d9f72ef Mon Sep 17 00:00:00 2001 From: bivashy Date: Fri, 20 Sep 2024 00:57:46 +0500 Subject: [PATCH 11/32] Inlay hint tooltip implementation --- plugin/inlay_hint.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 50c9e2e8f..80bf22fff 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -168,15 +168,19 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui }) value += f'' raw_label = label_part['value'] - if len(raw_label) > remaining_truncate_limit: + truncated = len(raw_label) > remaining_truncate_limit + if truncated: truncated_label = raw_label[:remaining_truncate_limit] + '…' else: truncated_label = raw_label + remaining_truncate_limit -= len(raw_label) value += html.escape(truncated_label) if has_command: value += "" # InlayHintLabelPart.location is not supported instruction_text = '\nDouble-click to execute' if has_command else "" - result += f"{value}" + tooltip_label = "".join(label_part['value'] for label_part in label) + truncation_tooltip = html.escape('\n' + tooltip_label) if truncated else "" + result += f"{value}" return result From 1ba72a66d41777c5b0f4ad237b149efba63b16ad Mon Sep 17 00:00:00 2001 From: bivashy Date: Sun, 22 Sep 2024 21:29:29 +0500 Subject: [PATCH 12/32] Read from user preference directly --- plugin/inlay_hint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 80bf22fff..b38c1e286 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -97,7 +97,7 @@ def inlay_hint_to_phantom(view: sublime.View, inlay_hint: InlayHint, session: Se def get_inlay_hint_html(view: sublime.View, inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: - truncate_limit = view.settings().get("inlay_hints_truncate_limit", userprefs().inlay_hints_truncate_limit) + truncate_limit = userprefs().inlay_hints_truncate_limit label = format_inlay_hint_label(inlay_hint, session, phantom_uuid, truncate_limit) font = view.settings().get('font_face') or "monospace" html = f""" From 1c313b55eb4f3b13eb7f1922df409c6163a0c3ae Mon Sep 17 00:00:00 2001 From: bivashy Date: Sun, 22 Sep 2024 21:29:47 +0500 Subject: [PATCH 13/32] Show truncation tooltip if label is raw string --- plugin/inlay_hint.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index b38c1e286..4966e0462 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -143,8 +143,11 @@ 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 - result += f'{html.escape(truncated_label)}' + 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'{html.escape(truncated_label)}' if is_clickable: result += "" return result From c618857131ad3a18c74e66474f54d417aa736932 Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 26 Sep 2024 11:36:00 +0500 Subject: [PATCH 14/32] Fix typo --- plugin/inlay_hint.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 4966e0462..05276552d 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -145,8 +145,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui instruction_text = '\nDouble-click to insert' if has_text_edits else "" 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 "" + truncation_tooltip = html.escape('\n' + label) if truncated else "" result += f'{html.escape(truncated_label)}' if is_clickable: result += "" From 08b9795cdb829d43d6b4d6716f75a3eb38ce22ca Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 26 Sep 2024 11:37:47 +0500 Subject: [PATCH 15/32] Remove truncate_limit parameter --- plugin/inlay_hint.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 05276552d..0d988455b 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -97,8 +97,7 @@ def inlay_hint_to_phantom(view: sublime.View, inlay_hint: InlayHint, session: Se def get_inlay_hint_html(view: sublime.View, inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: - truncate_limit = userprefs().inlay_hints_truncate_limit - label = format_inlay_hint_label(inlay_hint, session, phantom_uuid, truncate_limit) + label = format_inlay_hint_label(inlay_hint, session, phantom_uuid) font = view.settings().get('font_face') or "monospace" html = f""" @@ -124,7 +123,8 @@ def format_inlay_hint_tooltip(tooltip: str | MarkupContent | None) -> str: return "" -def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uuid: str, truncate_limit: int) -> str: +def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: + truncate_limit = userprefs().inlay_hints_truncate_limit tooltip = format_inlay_hint_tooltip(inlay_hint.get("tooltip")) result = "" can_resolve_inlay_hint = session.has_capability('inlayHintProvider.resolveProvider') From 9f0f3c712b4be52fe5f5d38a8310f223e3e6e871 Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 26 Sep 2024 11:41:36 +0500 Subject: [PATCH 16/32] Use ternary operator instead of plain if else --- plugin/inlay_hint.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 0d988455b..5721e8378 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -171,10 +171,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui value += f'' raw_label = label_part['value'] truncated = len(raw_label) > remaining_truncate_limit - if truncated: - truncated_label = raw_label[:remaining_truncate_limit] + '…' - else: - truncated_label = raw_label + truncated_label = raw_label[:remaining_truncate_limit] + '…' if truncated else raw_label remaining_truncate_limit -= len(raw_label) value += html.escape(truncated_label) From 1a09aa53070f4972306a8462de778665b8c568ff Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 26 Sep 2024 11:41:54 +0500 Subject: [PATCH 17/32] Fix flake8 formatting --- plugin/inlay_hint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 5721e8378..e0c0773f5 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -146,7 +146,8 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui truncated = len(label) > truncate_limit truncated_label = label[:truncate_limit] + '…' if truncated else label truncation_tooltip = html.escape('\n' + label) if truncated else "" - result += f'{html.escape(truncated_label)}' + result_tooltip = (tooltip + instruction_text + truncation_tooltip).strip() + result += f'{html.escape(truncated_label)}' if is_clickable: result += "" return result From 1a5bae46dcac82e7cc0336f091407c5da3d528f1 Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 26 Sep 2024 11:42:51 +0500 Subject: [PATCH 18/32] Remove redundant blank line --- plugin/inlay_hint.py | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index e0c0773f5..31e4d5dfb 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -173,7 +173,6 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui raw_label = label_part['value'] truncated = len(raw_label) > remaining_truncate_limit truncated_label = raw_label[:remaining_truncate_limit] + '…' if truncated else raw_label - remaining_truncate_limit -= len(raw_label) value += html.escape(truncated_label) if has_command: From 0fcdf798ecc1a97dd7bf44b4275d317a2f1548f5 Mon Sep 17 00:00:00 2001 From: bivashy Date: Fri, 27 Sep 2024 19:31:49 +0500 Subject: [PATCH 19/32] Properly show truncation tooltip --- plugin/inlay_hint.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 31e4d5dfb..6cadae0bc 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -125,6 +125,8 @@ def format_inlay_hint_tooltip(tooltip: str | MarkupContent | None) -> str: def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: truncate_limit = userprefs().inlay_hints_truncate_limit + truncated = False + tooltip = format_inlay_hint_tooltip(inlay_hint.get("tooltip")) result = "" can_resolve_inlay_hint = session.has_capability('inlayHintProvider.resolveProvider') @@ -145,11 +147,13 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui instruction_text = '\nDouble-click to insert' if has_text_edits else "" truncated = len(label) > truncate_limit truncated_label = label[:truncate_limit] + '…' if truncated else label - truncation_tooltip = html.escape('\n' + label) if truncated else "" - result_tooltip = (tooltip + instruction_text + truncation_tooltip).strip() + result_tooltip = (tooltip + instruction_text).strip() result += f'{html.escape(truncated_label)}' if is_clickable: result += "" + if truncated: + truncation_tooltip = html.escape('\n' + label) + result = f"{result}" return result remaining_truncate_limit = truncate_limit @@ -179,7 +183,9 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui value += "" # InlayHintLabelPart.location is not supported instruction_text = '\nDouble-click to execute' if has_command else "" + result += f"{value}" + if truncated: tooltip_label = "".join(label_part['value'] for label_part in label) - truncation_tooltip = html.escape('\n' + tooltip_label) if truncated else "" - result += f"{value}" + truncation_tooltip = html.escape('\n' + tooltip_label) + result = f"{result}" return result From bc41741055fed8ccac2f7b91a2372baea218e214 Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 3 Oct 2024 00:37:20 +0500 Subject: [PATCH 20/32] Remove redundant newline in truncation tooltip --- plugin/inlay_hint.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 6cadae0bc..e0dbebdea 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -152,7 +152,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui if is_clickable: result += "" if truncated: - truncation_tooltip = html.escape('\n' + label) + truncation_tooltip = html.escape(label) result = f"{result}" return result @@ -186,6 +186,6 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui result += f"{value}" if truncated: tooltip_label = "".join(label_part['value'] for label_part in label) - truncation_tooltip = html.escape('\n' + tooltip_label) + truncation_tooltip = html.escape(tooltip_label) result = f"{result}" return result From abe09875b6b058e45fd97fda86b92df0ab838881 Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 3 Oct 2024 00:43:42 +0500 Subject: [PATCH 21/32] Inclusive truncate limit --- plugin/inlay_hint.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index e0dbebdea..b0cbd8834 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -145,7 +145,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 = len(label) > truncate_limit + truncated = len(label) >= truncate_limit truncated_label = label[:truncate_limit] + '…' if truncated else label result_tooltip = (tooltip + instruction_text).strip() result += f'{html.escape(truncated_label)}' @@ -158,7 +158,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")) @@ -175,7 +175,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui }) value += f'' raw_label = label_part['value'] - truncated = len(raw_label) > remaining_truncate_limit + truncated = len(raw_label) >= remaining_truncate_limit truncated_label = raw_label[:remaining_truncate_limit] + '…' if truncated else raw_label remaining_truncate_limit -= len(raw_label) value += html.escape(truncated_label) From 17591c1aa66cf73764684a89250ef0a817b18112 Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 3 Oct 2024 00:48:28 +0500 Subject: [PATCH 22/32] Change default truncate limit to `100` --- LSP.sublime-settings | 2 +- plugin/core/types.py | 2 +- sublime-package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LSP.sublime-settings b/LSP.sublime-settings index d66ff6629..e0005231e 100644 --- a/LSP.sublime-settings +++ b/LSP.sublime-settings @@ -181,7 +181,7 @@ "show_inlay_hints": false, // Truncate limit for inlay hints. Truncates and adds an ellipsis at the end. - "inlay_hints_truncate_limit": 1000, + "inlay_hints_truncate_limit": 100, // Highlighting style of "highlights": accentuating nearby text entities that // are related to the one under your cursor. diff --git a/plugin/core/types.py b/plugin/core/types.py index d7c2a09e8..3937639cf 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -273,7 +273,7 @@ def r(name: str, default: bool | int | str | list | dict) -> None: r("show_code_actions", "annotation") r("show_code_lens", "annotation") r("show_inlay_hints", False) - r("inlay_hints_truncate_limit", 1000) + r("inlay_hints_truncate_limit", 100) r("show_diagnostics_in_hover", True) r("show_code_actions_in_hover", True) r("show_diagnostics_annotations_severity_level", 0) diff --git a/sublime-package.json b/sublime-package.json index 79efa3d53..4534b6426 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -741,7 +741,7 @@ }, "inlay_hints_truncate_limit": { "type": "integer", - "default": 1000, + "default": 100, "minimum": 0, "markdownDescription": "Truncate limit for inlay hints. Truncates and adds an ellipsis at the end." }, From 09162a2561632c20226e57d41686cd8076870f13 Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 3 Oct 2024 00:57:41 +0500 Subject: [PATCH 23/32] Support negative, or zero truncate limit --- plugin/inlay_hint.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index b0cbd8834..962736aa3 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -145,7 +145,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 = len(label) >= truncate_limit + truncated = len(label) >= truncate_limit and truncate_limit > 0 truncated_label = label[:truncate_limit] + '…' if truncated else label result_tooltip = (tooltip + instruction_text).strip() result += f'{html.escape(truncated_label)}' @@ -158,7 +158,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 and truncate_limit > 0: break value = "" tooltip = format_inlay_hint_tooltip(label_part.get("tooltip")) @@ -175,7 +175,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui }) value += f'' raw_label = label_part['value'] - truncated = len(raw_label) >= remaining_truncate_limit + truncated = len(raw_label) >= remaining_truncate_limit and truncate_limit > 0 truncated_label = raw_label[:remaining_truncate_limit] + '…' if truncated else raw_label remaining_truncate_limit -= len(raw_label) value += html.escape(truncated_label) From 04967890aed3c71e741c9044dc4b8b1e5cc1e2c6 Mon Sep 17 00:00:00 2001 From: bivashy Date: Fri, 4 Oct 2024 19:46:48 +0500 Subject: [PATCH 24/32] Rename `inlay_hints_truncate_limit` into `inlay_hints_max_length` --- LSP.sublime-settings | 4 ++-- plugin/core/types.py | 4 ++-- plugin/inlay_hint.py | 2 +- sublime-package.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LSP.sublime-settings b/LSP.sublime-settings index e0005231e..d555f203e 100644 --- a/LSP.sublime-settings +++ b/LSP.sublime-settings @@ -180,8 +180,8 @@ // or a custom keybinding. "show_inlay_hints": false, - // Truncate limit for inlay hints. Truncates and adds an ellipsis at the end. - "inlay_hints_truncate_limit": 100, + // Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. + "inlay_hints_max_length": 100, // Highlighting style of "highlights": accentuating nearby text entities that // are related to the one under your cursor. diff --git a/plugin/core/types.py b/plugin/core/types.py index 089c09f01..583a31a1e 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -227,7 +227,7 @@ class Settings: show_code_actions = cast(str, None) show_code_lens = cast(str, None) show_inlay_hints = cast(bool, None) - inlay_hints_truncate_limit = cast(int, None) + inlay_hints_max_length = cast(int, None) show_diagnostics_in_hover = cast(bool, None) show_code_actions_in_hover = cast(bool, None) show_diagnostics_annotations_severity_level = cast(int, None) @@ -273,7 +273,7 @@ def r(name: str, default: bool | int | str | list | dict) -> None: r("show_code_actions", "annotation") r("show_code_lens", "annotation") r("show_inlay_hints", False) - r("inlay_hints_truncate_limit", 100) + r("inlay_hints_max_length", 100) r("show_diagnostics_in_hover", True) r("show_code_actions_in_hover", True) r("show_diagnostics_annotations_severity_level", 0) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index e19f2e246..523431de8 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -123,7 +123,7 @@ def format_inlay_hint_tooltip(tooltip: str | MarkupContent | None) -> str: def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: - truncate_limit = userprefs().inlay_hints_truncate_limit + truncate_limit = userprefs().inlay_hints_max_length truncated = False tooltip = format_inlay_hint_tooltip(inlay_hint.get("tooltip")) diff --git a/sublime-package.json b/sublime-package.json index 4534b6426..0039f0a30 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -739,7 +739,7 @@ "default": false, "markdownDescription": "Show inlay hints in the editor. Inlay hints are short annotations within the code, which show variable types or parameter names.\nThis is the default value used for new windows but can be overriden per-window using the `LSP: Toggle Inlay Hints` command from the Command Palette, Main Menu or a custom keybinding." }, - "inlay_hints_truncate_limit": { + "inlay_hints_max_length": { "type": "integer", "default": 100, "minimum": 0, From c6e0055b849610f937968c7ed8c80b6fb599124f Mon Sep 17 00:00:00 2001 From: bivashy Date: Thu, 10 Oct 2024 02:46:21 +0500 Subject: [PATCH 25/32] Append truncation tooltip instead of wrapping result --- plugin/inlay_hint.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 523431de8..35f06868a 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -124,7 +124,6 @@ def format_inlay_hint_tooltip(tooltip: str | MarkupContent | None) -> str: def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: truncate_limit = userprefs().inlay_hints_max_length - truncated = False tooltip = format_inlay_hint_tooltip(inlay_hint.get("tooltip")) result = "" @@ -143,19 +142,20 @@ 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 = len(label) >= truncate_limit and truncate_limit > 0 truncated_label = label[:truncate_limit] + '…' if truncated else label - result_tooltip = (tooltip + instruction_text).strip() + + instruction_text = '\nDouble-click to insert' if has_text_edits else "" + truncation_tooltip = f'\n{html.escape(label)}' if truncated else "" + result_tooltip = (tooltip + instruction_text + truncation_tooltip).strip() result += f'{html.escape(truncated_label)}' if is_clickable: result += "" - if truncated: - truncation_tooltip = html.escape(label) - result = f"{result}" return result remaining_truncate_limit = truncate_limit + full_label = "".join(label_part['value'] for label_part in label) + full_label_truncated = len(full_label) >= truncate_limit and truncate_limit > 0 for label_part in label: if remaining_truncate_limit <= 0 and truncate_limit > 0: break @@ -182,9 +182,6 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui value += "" # InlayHintLabelPart.location is not supported instruction_text = '\nDouble-click to execute' if has_command else "" - result += f"{value}" - if truncated: - tooltip_label = "".join(label_part['value'] for label_part in label) - truncation_tooltip = html.escape(tooltip_label) - result = f"{result}" + truncation_tooltip = f'\n{html.escape(full_label)}' if full_label_truncated else "" + result += f"{value}" return result From b83a1474059562bc0a72c7c68947aa3777b8822a Mon Sep 17 00:00:00 2001 From: bivashy Date: Fri, 25 Oct 2024 17:15:42 +0500 Subject: [PATCH 26/32] Remove empty lines --- plugin/inlay_hint.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 35f06868a..cb08d9277 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -124,7 +124,6 @@ def format_inlay_hint_tooltip(tooltip: str | MarkupContent | None) -> str: def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uuid: str) -> str: truncate_limit = userprefs().inlay_hints_max_length - tooltip = format_inlay_hint_tooltip(inlay_hint.get("tooltip")) result = "" can_resolve_inlay_hint = session.has_capability('inlayHintProvider.resolveProvider') @@ -144,7 +143,6 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui result += f'' truncated = len(label) >= truncate_limit and truncate_limit > 0 truncated_label = label[:truncate_limit] + '…' if truncated else label - instruction_text = '\nDouble-click to insert' if has_text_edits else "" truncation_tooltip = f'\n{html.escape(label)}' if truncated else "" result_tooltip = (tooltip + instruction_text + truncation_tooltip).strip() @@ -152,7 +150,6 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui if is_clickable: result += "" return result - remaining_truncate_limit = truncate_limit full_label = "".join(label_part['value'] for label_part in label) full_label_truncated = len(full_label) >= truncate_limit and truncate_limit > 0 From 9be92d9085791260140dc74a96ec3670a313fbc0 Mon Sep 17 00:00:00 2001 From: bivashy Date: Fri, 25 Oct 2024 17:41:28 +0500 Subject: [PATCH 27/32] Change truncation limit to exclusive one. --- plugin/inlay_hint.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index cb08d9277..7ff9cb011 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -141,8 +141,8 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui } }) result += f'' - truncated = len(label) >= truncate_limit and truncate_limit > 0 - truncated_label = label[:truncate_limit] + '…' if truncated else label + truncated = len(label) > truncate_limit and truncate_limit > 0 + truncated_label = label[:truncate_limit - 1] + '…' if truncated else label instruction_text = '\nDouble-click to insert' if has_text_edits else "" truncation_tooltip = f'\n{html.escape(label)}' if truncated else "" result_tooltip = (tooltip + instruction_text + truncation_tooltip).strip() @@ -154,7 +154,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui full_label = "".join(label_part['value'] for label_part in label) full_label_truncated = len(full_label) >= truncate_limit and truncate_limit > 0 for label_part in label: - if remaining_truncate_limit <= 0 and truncate_limit > 0: + if remaining_truncate_limit < 0 and truncate_limit > 0: break value = "" tooltip = format_inlay_hint_tooltip(label_part.get("tooltip")) @@ -171,8 +171,8 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui }) value += f'' raw_label = label_part['value'] - truncated = len(raw_label) >= remaining_truncate_limit and truncate_limit > 0 - truncated_label = raw_label[:remaining_truncate_limit] + '…' if truncated else raw_label + truncated = len(raw_label) > remaining_truncate_limit and truncate_limit > 0 + truncated_label = raw_label[:remaining_truncate_limit - 1] + '…' if truncated else raw_label remaining_truncate_limit -= len(raw_label) value += html.escape(truncated_label) if has_command: From dc7d5ca31f0918a586659d12ee735ca17c18a215 Mon Sep 17 00:00:00 2001 From: bivashy Date: Sat, 26 Oct 2024 01:46:39 +0500 Subject: [PATCH 28/32] Match `sublime-package.json` with settings description --- sublime-package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sublime-package.json b/sublime-package.json index 0039f0a30..45ae72070 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -743,7 +743,7 @@ "type": "integer", "default": 100, "minimum": 0, - "markdownDescription": "Truncate limit for inlay hints. Truncates and adds an ellipsis at the end." + "markdownDescription": "Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis." }, "initially_folded": { "type": "array", From d6a544a1fa3a558b16bb485fd454fed6a07d5777 Mon Sep 17 00:00:00 2001 From: bivashy Date: Mon, 4 Nov 2024 09:18:10 +0500 Subject: [PATCH 29/32] Change truncation limit to exclusive --- plugin/inlay_hint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/inlay_hint.py b/plugin/inlay_hint.py index 9ae29f82f..69ffc6a1c 100644 --- a/plugin/inlay_hint.py +++ b/plugin/inlay_hint.py @@ -152,7 +152,7 @@ def format_inlay_hint_label(inlay_hint: InlayHint, session: Session, phantom_uui return result remaining_truncate_limit = truncate_limit full_label = "".join(label_part['value'] for label_part in label) - full_label_truncated = len(full_label) >= truncate_limit and truncate_limit > 0 + full_label_truncated = len(full_label) > truncate_limit and truncate_limit > 0 for label_part in label: if remaining_truncate_limit < 0 and truncate_limit > 0: break From a43e68adbd1c500e8f887f626bf5282e6a72b11e Mon Sep 17 00:00:00 2001 From: bivashy Date: Mon, 4 Nov 2024 09:27:28 +0500 Subject: [PATCH 30/32] Lower the limit of the inlay hint --- LSP.sublime-settings | 2 +- plugin/core/types.py | 2 +- sublime-package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LSP.sublime-settings b/LSP.sublime-settings index d555f203e..8496cad7d 100644 --- a/LSP.sublime-settings +++ b/LSP.sublime-settings @@ -181,7 +181,7 @@ "show_inlay_hints": false, // Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. - "inlay_hints_max_length": 100, + "inlay_hints_max_length": 30, // Highlighting style of "highlights": accentuating nearby text entities that // are related to the one under your cursor. diff --git a/plugin/core/types.py b/plugin/core/types.py index f44edfa0e..b5d5b932f 100644 --- a/plugin/core/types.py +++ b/plugin/core/types.py @@ -273,7 +273,7 @@ def r(name: str, default: bool | int | str | list | dict) -> None: r("show_code_actions", "annotation") r("show_code_lens", "annotation") r("show_inlay_hints", False) - r("inlay_hints_max_length", 100) + r("inlay_hints_max_length", 30) r("show_diagnostics_in_hover", True) r("show_code_actions_in_hover", True) r("show_diagnostics_annotations_severity_level", 0) diff --git a/sublime-package.json b/sublime-package.json index 45ae72070..def4e95dd 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -741,7 +741,7 @@ }, "inlay_hints_max_length": { "type": "integer", - "default": 100, + "default": 30, "minimum": 0, "markdownDescription": "Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis." }, From 572b1cd7699544fc92a1deedcdd550d190254818 Mon Sep 17 00:00:00 2001 From: bivashy Date: Fri, 8 Nov 2024 10:37:31 +0500 Subject: [PATCH 31/32] Specify missing truncation case in description --- LSP.sublime-settings | 2 +- sublime-package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/LSP.sublime-settings b/LSP.sublime-settings index 8496cad7d..431b26059 100644 --- a/LSP.sublime-settings +++ b/LSP.sublime-settings @@ -180,7 +180,7 @@ // or a custom keybinding. "show_inlay_hints": false, - // Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. + // Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. Zero or less means no truncation. "inlay_hints_max_length": 30, // Highlighting style of "highlights": accentuating nearby text entities that diff --git a/sublime-package.json b/sublime-package.json index def4e95dd..0c0fc3d1c 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -743,7 +743,7 @@ "type": "integer", "default": 30, "minimum": 0, - "markdownDescription": "Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis." + "markdownDescription": "Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. Zero or less means no truncation." }, "initially_folded": { "type": "array", From b039ea86aee57fa20b4665945425d838510996b6 Mon Sep 17 00:00:00 2001 From: Janos Wortmann Date: Sun, 10 Nov 2024 15:36:32 +0100 Subject: [PATCH 32/32] Tweak setting description --- LSP.sublime-settings | 3 ++- sublime-package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/LSP.sublime-settings b/LSP.sublime-settings index 431b26059..4a5a7c141 100644 --- a/LSP.sublime-settings +++ b/LSP.sublime-settings @@ -180,7 +180,8 @@ // or a custom keybinding. "show_inlay_hints": false, - // Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. Zero or less means no truncation. + // Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. + // Set to 0 for unlimited length. "inlay_hints_max_length": 30, // Highlighting style of "highlights": accentuating nearby text entities that diff --git a/sublime-package.json b/sublime-package.json index 0c0fc3d1c..f98b52c50 100644 --- a/sublime-package.json +++ b/sublime-package.json @@ -743,7 +743,7 @@ "type": "integer", "default": 30, "minimum": 0, - "markdownDescription": "Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. Zero or less means no truncation." + "markdownDescription": "Maximum length for inlay hints. Truncates exceeding characters and adds an ellipsis. Set to 0 for unlimited length." }, "initially_folded": { "type": "array",