This change updates the semantic token highlighter so that stored-procedure names appearing as braced arguments to lappend (and ::lappend) are emitted with the function token type.
Before: braced literal arguments to lappend that matched known custom or standard procedure names were not highlighted as functions.
After: when the command routine is lappend or ::lappend, any BracedWord argument whose contents matches self._custom_function_names | _STANDARD_PROC_NAMES is recorded as a function token at the argument's contents_pos with length len(argument.contents).
Key changes
Import BracedWord from tclint.syntax_tree.
In _Highlighter.visit_command, detect lappend / ::lappend and iterate command.args:
If an argument is a BracedWord and its contents is in the union of custom and standard proc names, append a function semantic token using argument.contents_pos and len(argument.contents).
No other command handling was changed; routine-name highlighting remains as before.
Testing
No test execution results were provided.
Recommended checks for reviewers:
Create a small Tcl snippet such as lappend mylist {stored_proc} where stored_proc is present in the project's custom function set, and run the semantic token generation to confirm a function token is emitted for the braced name at the expected position and length.
Verify that unrelated braced literals (not matching known proc names) are not highlighted as functions.
Notes / Risk
The change only affects highlighting of braced arguments to lappend/::lappend and only when the braced literal matches known custom or standard procedure names.
Implementation uses argument.contents_pos for token placement; reviewers may want to confirm that position computation matches other token emission code paths.
This change updates the semantic token highlighter so that stored-procedure names appearing as braced arguments to `lappend` (and `::lappend`) are emitted with the `function` token type.
Before: braced literal arguments to `lappend` that matched known custom or standard procedure names were not highlighted as functions.
After: when the command routine is `lappend` or `::lappend`, any `BracedWord` argument whose `contents` matches `self._custom_function_names | _STANDARD_PROC_NAMES` is recorded as a `function` token at the argument's `contents_pos` with length `len(argument.contents)`.
## Key changes
- Import `BracedWord` from `tclint.syntax_tree`.
- In `_Highlighter.visit_command`, detect `lappend` / `::lappend` and iterate `command.args`:
- If an argument is a `BracedWord` and its `contents` is in the union of custom and standard proc names, append a `function` semantic token using `argument.contents_pos` and `len(argument.contents)`.
- No other command handling was changed; routine-name highlighting remains as before.
## Testing
No test execution results were provided.
Recommended checks for reviewers:
- Create a small Tcl snippet such as `lappend mylist {stored_proc}` where `stored_proc` is present in the project's custom function set, and run the semantic token generation to confirm a `function` token is emitted for the braced name at the expected position and length.
- Verify that unrelated braced literals (not matching known proc names) are not highlighted as functions.
## Notes / Risk
- The change only affects highlighting of braced arguments to `lappend`/`::lappend` and only when the braced literal matches known custom or standard procedure names.
- Implementation uses `argument.contents_pos` for token placement; reviewers may want to confirm that position computation matches other token emission code paths.
Christoph
added 1 commit 2026-09-21 19:13:24 +00:00
Treat braced lappend arguments that match custom or standard procedure names as
function tokens for semantic highlighting. This applies the same visual
highlighting as calls but does not treat the literal as executable Tcl. Previously
such braced stored-proc names were not highlighted.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
This change updates the semantic token highlighter so that stored-procedure names appearing as braced arguments to
lappend(and::lappend) are emitted with thefunctiontoken type.Before: braced literal arguments to
lappendthat matched known custom or standard procedure names were not highlighted as functions.After: when the command routine is
lappendor::lappend, anyBracedWordargument whosecontentsmatchesself._custom_function_names | _STANDARD_PROC_NAMESis recorded as afunctiontoken at the argument'scontents_poswith lengthlen(argument.contents).Key changes
BracedWordfromtclint.syntax_tree._Highlighter.visit_command, detectlappend/::lappendand iteratecommand.args:BracedWordand itscontentsis in the union of custom and standard proc names, append afunctionsemantic token usingargument.contents_posandlen(argument.contents).Testing
No test execution results were provided.
Recommended checks for reviewers:
lappend mylist {stored_proc}wherestored_procis present in the project's custom function set, and run the semantic token generation to confirm afunctiontoken is emitted for the braced name at the expected position and length.Notes / Risk
lappend/::lappendand only when the braced literal matches known custom or standard procedure names.argument.contents_posfor token placement; reviewers may want to confirm that position computation matches other token emission code paths.