diff --git a/server/src/tools/semantic_tokens.py b/server/src/tools/semantic_tokens.py index fa67bb8..974998f 100644 --- a/server/src/tools/semantic_tokens.py +++ b/server/src/tools/semantic_tokens.py @@ -4,7 +4,7 @@ from typing import List import attrs from common.load_data import standard_items from tclint.commands.plugins import PluginManager -from tclint.syntax_tree import BareWord, Command, QuotedWord, Visitor +from tclint.syntax_tree import BareWord, BracedWord, Command, QuotedWord, Visitor from tools.variable_names import variable_name from tools.tcloo_symbols import class_symbols from tools.tcloo_completion import _analyze @@ -173,6 +173,15 @@ class _Highlighter(Visitor): def visit_command(self, command: Command): routine = command.routine + # Stored procedure names in braced lappend arguments use the same + # highlighting as calls, without treating the literal as executable Tcl. + if routine.contents in {"lappend", "::lappend"}: + for argument in command.args: + if (isinstance(argument, BracedWord) + and argument.contents in self._custom_function_names | _STANDARD_PROC_NAMES): + line, col = argument.contents_pos + self._append_token((line - 1, col - 1), len(argument.contents), "function", []) + # Highlight functions (custom or standard) when used as the routine name = getattr(routine, "contents", None) if name: