feat(lsp): add goto declaration for FB, DB, and UDT types

- Add declaration provider (gD) that finds definitions for:
  - Functions in .scl files
  - Function Blocks (FB) in .scl files
  - Data Blocks (DB) in .scl and .db files
  - User-Defined Types (UDT) in .scl and .udt files
- Implement project root detection for cross-directory searches
- Add duplicate location filtering to prevent multiple results
- Load UDT types from .udt files in plc_json
- Update documentation with goto declaration feature
This commit is contained in:
2026-02-19 18:01:30 +01:00
parent e0db21381a
commit 35eae17f4f
+11
View File
@@ -235,6 +235,17 @@ Rules are checked in order; first match wins.
| `:SCLExpandAllAttrBlocks` | Expand all `{...}` blocks in buffer | | `:SCLExpandAllAttrBlocks` | Expand all `{...}` blocks in buffer |
| `:SCLCollapseAllAttrBlocks` | Collapse all matching attribute blocks | | `:SCLCollapseAllAttrBlocks` | Collapse all matching attribute blocks |
## LSP Features
### Goto Declaration (`gD`)
The LSP supports goto declaration functionality for:
- **Functions** - Jump to function definition in `.scl` files
- **Function Blocks (FB)** - Jump to FB definition in `.scl` files
- **Data Blocks (DB)** - Jump to DB definition in `.scl` and `.db` files
- **User-Defined Types (UDT)** - Jump to type definition in `.scl` and `.udt` files
Usage: Place cursor on a variable or type name and press `gD` (or use LSP client command).
## Keybindings (SCL/UDT files) ## Keybindings (SCL/UDT files)
### Attribute Block Toggle ### Attribute Block Toggle