add more semantic tokens

This commit is contained in:
2025-07-30 22:10:27 +02:00
parent ed045aa459
commit fed8b84b46
4 changed files with 253 additions and 21 deletions
+28 -2
View File
@@ -3,8 +3,6 @@ from typing import List
from tclint.syntax_tree import Visitor
from tclint.commands import get_commands
import attrs
from common.load_data import standard_items
import lsprotocol.types as lsp
class TokenModifier(enum.IntFlag):
@@ -63,6 +61,34 @@ class _Highlighter(Visitor):
(((line - 1, col - 1), len(first_arg.value), "function"))
)
if len(command.args) >= 2:
param_list = command.args[1]
# BracedWord oder Liste erwartet
if hasattr(param_list, "children"):
for child in param_list.children:
# Parameter kann einfaches Wort sein
if hasattr(child, "value") and child.value is not None:
line, col = child.pos
self._tokens.append(
((line - 1, col - 1), len(child.value), "variable")
)
# Parameter mit Default-Wert ist meist eine List (z.B. {arg default})
elif hasattr(child, "children") and len(child.children) >= 1:
name_node = child.children[0]
if hasattr(name_node, "value") and hasattr(
name_node, "pos"
):
line, col = name_node.pos
self._tokens.append(
(
(line - 1, col - 1),
len(name_node.value),
"variable",
)
)
if routine.contents == "namespace" and command.args:
first_arg = command.args[1]
if hasattr(first_arg, "pos") and hasattr(first_arg, "value"):