From 35eae17f4fb01945b0324b9e7cfb36704974b80c Mon Sep 17 00:00:00 2001 From: Lazar Bulovan Date: Thu, 19 Feb 2026 18:01:30 +0100 Subject: [PATCH 1/3] 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 --- AGENTS.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index d0c9551..1fbea2f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -235,6 +235,17 @@ Rules are checked in order; first match wins. | `:SCLExpandAllAttrBlocks` | Expand all `{...}` blocks in buffer | | `: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) ### Attribute Block Toggle From ff311b88b9394be48067a29aca4f1f5185b60e53 Mon Sep 17 00:00:00 2001 From: Lazar Bulovan Date: Thu, 19 Feb 2026 18:07:04 +0100 Subject: [PATCH 2/3] docs: update README with goto declaration feature --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 18e59e0..46ee012 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ A comprehensive Neovim/LazyVim plugin providing **Language Server Protocol (LSP) |---------|-------------| | **Hover** | Press `K` to see variable type and struct fields | | **Completion** | `#` for variables, `.` for struct fields, `(` for functions | -| **Go to Definition** | `gd` jump to variable declaration | +| **Go to Definition** | `gD` jump to function, FB, DB, or UDT definition | | **Document Symbols** | Shows functions, variables, types | | **Workspace Symbols** | Search across all `.scl` files with fuzzy matching | | **Semantic Tokens** | Keywords, variables highlighted | From c4d65d5c87d5c71f4971f0411e7d6bd254985104 Mon Sep 17 00:00:00 2001 From: Lazar Bulovan Date: Fri, 20 Feb 2026 09:01:06 +0100 Subject: [PATCH 3/3] docs: add filetype detection section to AGENTS.md --- AGENTS.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 1fbea2f..8e6c0d9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -50,6 +50,18 @@ scl_lsp/ └── grammar.js # Tree-sitter grammar ``` +## Filetype Detection + +The LSP requires the `scl` filetype to be set. Add to your Neovim config (e.g., `ftdetect/scl.vim`): + +```vim +au BufRead,BufNewFile *.scl set filetype=scl +au BufRead,BufNewFile *.udt set filetype=scl +au BufRead,BufNewFile *.db set filetype=scl +``` + +This enables LSP features (completion, goto definition, hover, etc.) for all SCL-related file types. + ## Code Style Guidelines ### Module Pattern