Show effective (last-loaded) .def declaration in hover and GoTo #50
Loading…
Reference in a new issue
No description provided.
Delete branch "refs/pull/50/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 makes hover and Go To Definition return the effective declaration for DEF block templates/addresses — the declaration from the last-loaded
.deffile in PSC layer order — and names any declarations it overrides. Find References and Rename still operate across all declarations.What changed
.defdefinition locations now return only the effective (last-loaded) declaration for hover and GoTo behaviors. Concretely:server/src/tools/def_navigation.pyaddseffective_def_locations(documents, target, uris)which returns the last item ofdef_definition_locations(...)(the declaration NX would use when multiple PSC layers declare the same name).def_hover_markdown(...)now formats hover content using the effective declaration and, when there are multiple declarations, appends a short_Overrides ..._note listing the overridden file:line locations.server/src/lsp_server.pyuseseffective_def_locations(...)for thegoto_definitionanddef_definitionpaths instead of the previousdef_definition_locations(...)result.CHANGELOG.mdandserver/tests/python_tests/test_def_navigation.pywere updated: a new testtest_template_in_several_layers_shows_the_last_loaded_oneexercises layered PSC behavior (two.deffiles in different layers) and asserts that hover and goto point to the last-loaded declaration while references include all declarations.Behavior before / after
The new test creates two layered
.deffiles (ctrl/ctrl.def,oem/oem.def) with differing template text and apost.pscPSC ordering file; it asserts hover content begins with the effective file (oem.def), contains the effective declaration text, ends with an_Overrides ctrl.def:5_note, thatgoto_definitionresolves tooem/oem.def, and thatreferencesstill returns both.deffiles plus the caller.Tests
server/tests/python_tests/test_def_navigation.pyincludestest_template_in_several_layers_shows_the_last_loaded_onecovering hover, goto, and references for layered PSC.Recommended checks for reviewers:
test_def_navigation.py) to verify the new layered-PSC assertions..defdeclarations of the same name and confirm hover and Go To Definition show the last-loaded declaration and list overridden locations, while Find References returns all occurrences.Compatibility / notes