Add .def navigation helpers and tests #47
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/47/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 adds navigation and rename helper functions for .def files and corresponding unit tests.
The new module
server/src/tools/def_navigation.pyimplements symbol lookup and cross-file navigation between .def declarations (formats, addresses, block templates) and Tcl callers. Key behaviors provided by the code:def_symbol_at) and produce an LSP range for it.def_declarations,def_definition_locations,def_reference_locations).tcl_def_occurrences) and merge them with .def locations (all_def_target_locations).def_rename_edits) — returnsNonewhen the target is not a declared symbol.def_hover_markdown), including a formatted table of address properties and modality annotations.Tests were added under
server/tests/python_tests/test_def_navigation.py. The test suite covers:.defdocuments to extract declarations and references..def-scoped requests..deftext when handling.def-specific requests.Testing
lsp_server(goto_definition,hover,references,prepare_rename,rename) and the custom.defrequests (def_definition,def_hover,def_references,def_prepare_rename,def_rename).Recommended checks for reviewers:
pytest server/tests/python_tests/test_def_navigation.py(or run the whole test suite) and verify they pass in your environment.PSC/DEF/TCLsetup and exercise go-to-definition, hover and rename flows from an editor client to confirm handlers are wired correctly.Compatibility and notes
def_rename_editsintentionally returnsNonewhen the target has no declaration (rename is only allowed for declared symbols).If you want, I can run through any specific function or test case in the diff during review or suggest additional edge-case tests (e.g. multiple declarations with the same name across documents, or overlapping edits across files).