Recognize derived .def names and show .def previews on completion resolve #48
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/48/head"
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 extends .def symbol resolution and completion previews to names that reach NX commands indirectly (via variables or proc parameters), and adds a completion-item resolve handler to show the same .def preview as hover.
Summary
MOM_do_template steady_rest).set,lappend,list,foreach) or through proc parameters (including nested wrapper procs). Completion items for .def symbols can now be resolved to include the same preview content as hover.Key behavior changes
data: {"def": [kind, name]}and the server advertisesresolve_provider=True. Selecting a completion item triggerstextDocument/completionItem/resolvewhich populates the itemdocumentationwith the same Markdown preview used by hover.server/src/tools/def_flow.py, implements the flow solver, proc parameter flow extraction, and wrapper-table construction. The LSP server caches adef_wrapper_table()built from navigation indexes and uses it when resolving derived symbols.tools/navigation.pyre-exports the relevant helpers..gitea/workflows/tests.ymlthat runs the Python language-server tests and Node extension tests on push/pull_request tomain.Implementation notes (important for review)
def_flow.py:command_flow_facts), solves variable propagation, and computes where proc parameters end up (proc_def_flows).build_wrapper_tableresolves nested wrapper calls so a proc parameter can be known to carry.defnames of a given kind.derived_def_symbol(tree, position, table)returns(kinds, name, range)for a literal atpositionif the literal can be shown to reach a.defargument giventable.server/src/lsp_server.pyaddsCOMPLETION_ITEM_RESOLVEhandling and usesdef_hover_markdown(...)to create the preview documentation when the completion item'sdatacontains a.deftarget._tcl_def_symbolinlsp_server.pyuses the navigation context first; if none, it falls back toderived_def_symbolusing the server'sdef_wrapper_table()to decide whether the token is a derived .def symbol.data={"def": [kind, name]}so resolve can locate the target.Tests
test(completion_context): update test expectations and reflow formatting) and adds a CI workflow to run tests, but no test execution results are included with this change.No test execution results were provided.
Recommended checks for reviewers
python -m pytest tests/python_tests -q(the same command the new workflow runs underserver/withPYTHONPATH=libs).set,lappend,list,foreach, or through wrapper procs to ensure derived cases are resolved as expected.Compatibility and risk notes
Files and artifacts of interest
server/src/tools/def_flow.pyserver/src/lsp_server.py,server/src/lsp_tclserver.pyserver/src/tools/navigation.py.gitea/workflows/tests.ymlIf you'd like, I can point to specific diffs or walk through the
derived_def_symbollogic step-by-step during review.