Skip to content

Commit

Permalink
Fix LspToggleInlayHintsCommand not initializing (#2571)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwortmann authored Dec 9, 2024
1 parent 04ea961 commit c64ac00
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugin/inlay_hint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import annotations
from .core.constants import ST_VERSION
from .core.css import css
from .core.edit import apply_text_edits
from .core.protocol import InlayHint
Expand All @@ -21,7 +22,16 @@ class LspToggleInlayHintsCommand(LspWindowCommand):

def __init__(self, window: sublime.Window) -> None:
super().__init__(window)
window.settings().set('lsp_show_inlay_hints', userprefs().show_inlay_hints)
window.settings().setdefault('lsp_show_inlay_hints', self._get_default_value())

@staticmethod
def _get_default_value() -> bool:
settings = userprefs()
if settings is not None:
return settings.show_inlay_hints
if ST_VERSION >= 4171: # All API functions are available at import time
return sublime.load_settings('LSP.sublime-settings').get('show_inlay_hints')
return False

def run(self, enable: bool | None = None) -> None:
window_settings = self.window.settings()
Expand Down

0 comments on commit c64ac00

Please sign in to comment.