Preserve leading proc comments; add trace completions; fix unset option #63
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
state: Done
state: New
type: Bug
type: Feature
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Christoph/nx_post_support!63
Loading…
Reference in a new issue
No description provided.
Delete branch "58-nocomplain-is-missing"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This change combines three related updates:
tracecommand and its subcommands.unsetcommand option description to include the leading-for the-nocomplainoption.What changed (behavioral summary)
Formatter: The formatter now tracks proc bodies and, when formatting a proc body, keeps comments that appear before the body's first real command unindented. Previously, those header comments were indented along with the rest of the proc body. Concretely, the new logic records
id(command.args[-1])for commands whose routine isproc, andformat_scriptchecks whether the script object is a proc body. If so andshould_indentis true, it removes one indentation level only for initial comment lines (lines that start with the expected indent plus#) until the first non-comment or non-empty line, leaving subsequent lines and comments indented normally.Before: leading header comments inside a proc were indented along with the first command.
After: leading header comments remain at the proc's indentation level; the first actual command and everything after it are indented.
Completions: The Tcl completion tables gain entries for
traceand its subcommands. Specifically:SUBCOMMANDS_BY_PATHaddstracewith subcommandsadd,info,removeand their respective modes (command,execution,variable).VALUES_BY_POSITIONadds expected values fortrace add|removeforcommand,execution, andvariablekinds (e.g.rename,delete,enter,leave,array,read, etc.).DYNAMIC_COMPLETION_RULESadds dynamic completion rules fortrace ... variableto suggest variable names, and fortrace ... command|executionto suggest procedures where appropriate.unsetoption: TheOPTIONS_BY_PATHentry for("unset",)was changed to include-nocomplain(with the leading hyphen) instead ofnocomplain.Files touched (high-level)
format_scriptto keep leading comments unindented.tracesubcommands, values, and dynamic completion rules; replacednocomplainwith-nocomplainforunsetoptions.test_leading_proc_comments_are_not_indentedthat expresses the new expected output for leading comments in proc bodies.Testing
Tests or execution status: No test execution results were provided.
Tests added/changed:
server/tests/python_tests/test_formatter.pywas changed and a new testtest_leading_proc_comments_are_not_indentedwas added to assert the formatting behavior described above.Suggested checks for reviewers
test_formatter.py) to verify the new test expectations; inspect other formatter-related tests for unintended regressions.trace add|info|removein an environment that usestcl_command_completion.pyto confirm the static value suggestions and dynamic completions for variable and procedure positions.unset -nocomplainis recognized where the option parsing/metadata is used (search for usage sites relying onOPTIONS_BY_PATH).Compatibility / risk notes
should_indentis true. Reviewers should confirm no other code paths rely on the previous indentation of those comments.traceand is additive; it should not remove existing completions.No reviewer action is required beyond running the suggested tests and validating completions and option recognition where these tables are consumed.
Closes #58
Pull request closed