diff --git a/plugin/core/sessions.py b/plugin/core/sessions.py index 0f660af8c..05f5e75e7 100644 --- a/plugin/core/sessions.py +++ b/plugin/core/sessions.py @@ -1814,9 +1814,12 @@ def _set_focused_sheet(self, sheet: Optional[sublime.Sheet]) -> None: self.window.focus_sheet(sheet) def decode_semantic_token( - self, token_type_encoded: int, token_modifiers_encoded: int) -> Tuple[str, List[str], Optional[str]]: - types_legend = tuple(cast(List[str], self.get_capability('semanticTokensProvider.legend.tokenTypes'))) - modifiers_legend = tuple(cast(List[str], self.get_capability('semanticTokensProvider.legend.tokenModifiers'))) + self, + types_legend: Tuple[List[str]], + modifiers_legend: Tuple[List[str]], + token_type_encoded: int, + token_modifiers_encoded: int + ) -> Tuple[str, List[str], Optional[str]]: return decode_semantic_token( types_legend, modifiers_legend, self._semantic_tokens_map, token_type_encoded, token_modifiers_encoded) diff --git a/plugin/session_buffer.py b/plugin/session_buffer.py index 71febb56b..c8f56ab4d 100644 --- a/plugin/session_buffer.py +++ b/plugin/session_buffer.py @@ -630,6 +630,8 @@ def _draw_semantic_tokens_async(self) -> None: scope_regions = dict() # type: Dict[int, Tuple[str, List[sublime.Region]]] prev_line = 0 prev_col_utf16 = 0 + types_legend = tuple(cast(List[str], self.get_capability('semanticTokensProvider.legend.tokenTypes'))) + modifiers_legend = tuple(cast(List[str], self.get_capability('semanticTokensProvider.legend.tokenModifiers'))) for idx in range(0, len(self.semantic_tokens.data), 5): delta_line = self.semantic_tokens.data[idx] delta_start_utf16 = self.semantic_tokens.data[idx + 1] @@ -644,7 +646,7 @@ def _draw_semantic_tokens_async(self) -> None: prev_line = line prev_col_utf16 = col_utf16 token_type, token_modifiers, scope = self.session.decode_semantic_token( - token_type_encoded, token_modifiers_encoded) + types_legend, modifiers_legend, token_type_encoded, token_modifiers_encoded) if scope is None: # We can still use the meta scope and draw highlighting regions for custom token types if there is a # color scheme rule for this particular token type.