feat(def): add cross-file navigation and rename for PSC .def block templates and addresses
Add client and server support to navigate, inspect, reference, and rename block template and address symbols declared in PSC .def files: - Client: register language providers for .def (definition, hover, references, prepare/provide rename) and send the current document text with each request. - Server: parse .def files into DefDocument/DefDeclaration/DefReference, expose def-specific LSP endpoints (definition/hover/references/prepareRename/rename), and integrate .def lookups into existing Tcl hover/definition/references/rename flows so Tcl calls jump to .def declarations. - Tcl server keeps a snapshot API for .def documents (current editor content can replace file on request); only declared names in loaded .def files can be renamed. Name validation uses DEF_NAME_RE. Update README and CHANGELOG to document navigation features.
This commit is contained in:
@@ -75,6 +75,26 @@ Select the keyword from the completion list (or type it completely) to open the
|
||||
directly after the keyword, such as `ADDR_LISTSP`, narrows it. The keyword is replaced by the
|
||||
selected quoted name.
|
||||
|
||||
### Navigation between Tcl and DEF files
|
||||
|
||||
Block template and address names are linked to their declarations in the PSC `.def` files:
|
||||
|
||||
- **Go to Definition** (F12) on `MOM_do_template "steady_rest"` or `MOM_force Once X` jumps to
|
||||
`BLOCK_TEMPLATE steady_rest` or `ADDRESS X`. Inside a `.def` file, an address used in a block
|
||||
template (`X[$mom_pos(0)]`) jumps to its `ADDRESS` declaration.
|
||||
- **Hover** shows the body of a block template, or the format (resolved to its `FORMAT`
|
||||
definition), leader, trailer, min/max, and modality (`FORCE`) of an address.
|
||||
- **Find All References** (Shift+F12) lists the declaration, all Tcl calls, and all block templates
|
||||
that use an address.
|
||||
- **Rename** (F2) changes the declaration and all usages in Tcl and `.def` files together. Only
|
||||
names declared in a loaded `.def` file can be renamed.
|
||||
|
||||
Recognized Tcl commands: `MOM_do_template`, `MOM_add_to_block_buffer`, `MOM_polar_motion`,
|
||||
`MOM_force_block`, `MOM_ask_address_value`, `MOM_add_to_address_buffer`, `MOM_enable_address`,
|
||||
`MOM_disable_address`, `MOM_force`, `MOM_suppress`, `MOM_incremental`, and
|
||||
`MOM_ask_definition_element`/`MOM_has_definition_element` with `ADDRESS` or `BLOCK`. Names built
|
||||
from variables (`MOM_do_template $name`) cannot be resolved statically.
|
||||
|
||||
## NX Tcl Remote Debugger
|
||||
|
||||
### Add a VS Code attach configuration
|
||||
@@ -133,6 +153,7 @@ Simply open any supported file type and enjoy:
|
||||
- Context-aware completion with local symbols ranked before workspace and built-in symbols, plus semantic arguments, local paths, Tcl subcommands, and options such as `string compare -nocase`
|
||||
- Placeholder-based snippets for common Tcl control structures and procedures
|
||||
- Block template and address suggestions from PSC DEF files, including `BLOCK_LIST` and `ADDR_LIST`
|
||||
- Go to Definition, hover, references, and rename for block templates and addresses across Tcl and DEF files
|
||||
- Remote NX Tcl debugging with breakpoints and full stepping
|
||||
|
||||
## Contributing
|
||||
|
||||
Reference in New Issue
Block a user