chore: adjust README, AGENTS, and test runner for server-only scope
After splitting from the original scl_lsp repo, update documentation and test infrastructure to reflect the server-only scope of this repo. - README.md: focused on LSP server features, tree-sitter grammar, running the server, and Mason installation reference - AGENTS.md: server-only project structure and conventions - test/run_tests.lua: run only server tests (formatter, plc_json)
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
# AGENTS.md - tia-lsp
|
||||
|
||||
A Neovim/LazyVim plugin and standalone LSP server for Siemens TIA Portal languages. Currently supports **SCL**; planned support for STL/AWL, LAD, FBD. The project is split into two repos:
|
||||
|
||||
- **`tia-lsp`** (this repo) — LSP server (`src/`) + tree-sitter grammar (`grammar.js`). Editor-agnostic.
|
||||
- **`tia-lsp.nvim`** — Neovim plugin (`lua/`) that launches the server and adds editor features.
|
||||
A standalone LSP server for Siemens TIA Portal languages. Currently supports **SCL**; planned support for STL/AWL, LAD, FBD. This repo is the server only (`src/` + tree-sitter grammar). The companion Neovim plugin lives in `tia-lsp.nvim`.
|
||||
|
||||
## Build/Lint/Test Commands
|
||||
|
||||
@@ -20,16 +17,11 @@ tree-sitter parse <file.scl> # Parse single SCL file
|
||||
|
||||
# Lua Linting
|
||||
luacheck src/ # Lint LSP server code
|
||||
luacheck lua/tia/ # Lint plugin modules
|
||||
|
||||
# Unit & Integration Tests
|
||||
lua test/run_tests.lua # Run all tests
|
||||
lua test/test_udt.lua # Run UDT parser tests
|
||||
lua test/test_db.lua # Run DB parser tests
|
||||
lua test/test_fb.lua # Run FB parser tests
|
||||
# Unit Tests
|
||||
lua test/run_tests.lua # Run all server tests
|
||||
lua test/test_formatter.lua # Run formatter tests
|
||||
lua test/test_plc_json.lua # Run plc_json tests
|
||||
lua test/test_integration.lua # Run integration tests
|
||||
|
||||
# Reference Project
|
||||
# Tests use files from: ~/dev/siemens/projects/scl_lang_support_lazyvim_ref_project/
|
||||
@@ -49,38 +41,16 @@ tia-lsp/
|
||||
│ ├── plc_json.lua # External UDT/DB loading (language-agnostic)
|
||||
│ ├── builtin_instructions.lua # TIA Portal built-in types
|
||||
│ └── json.lua # JSON encoder/decoder
|
||||
├── lua/tia/ # Neovim plugin (uses require)
|
||||
│ ├── udt_parser.lua # UDT parser
|
||||
│ ├── db_parser.lua # Global DB parser
|
||||
│ ├── fb_parser.lua # Function Block parser
|
||||
│ ├── variables.lua # Variable extraction
|
||||
│ ├── workspace_types.lua # Workspace scanning
|
||||
│ ├── multiline_params.lua
|
||||
│ ├── auto_prefix.lua
|
||||
│ └── attr_toggle.lua
|
||||
├── lua/tia_lsp/ # Plugin entry point
|
||||
│ ├── init.lua # Main plugin setup (vim.lsp.start)
|
||||
│ └── plugins/scl.lua # LazyVim plugin spec
|
||||
├── queries/ # Tree-sitter queries (per-language: queries/scl/)
|
||||
└── grammar.js # Tree-sitter grammar (language name: 'scl')
|
||||
├── grammar.js # Tree-sitter grammar (language name: 'scl')
|
||||
└── test/ # Server tests
|
||||
```
|
||||
|
||||
## Naming Convention
|
||||
|
||||
- **Project name** (repo, Lua module, LSP server, mason package): `tia-lsp` / `tia_lsp` — umbrella for all TIA languages.
|
||||
- **Project name** (repo, LSP server, mason package): `tia-lsp` / `tia_lsp` — umbrella for all TIA languages.
|
||||
- **Language name** (filetype, tree-sitter parser, grammar): `scl` — stays as-is. Future languages (`stl`, `lad`, `fbd`) get their own names.
|
||||
- **LSP client name**: `tia_lsp` (one client handles all TIA languages; dispatches by `filetype` / `languageId`).
|
||||
- **Diagnostic source**: `tia_lsp`.
|
||||
- **Commands**: `:SCLFormat`, `:SCLShowVariables`, etc. — per-filetype prefix. Future: `:STLFormat`, etc.
|
||||
|
||||
## Filetype Detection
|
||||
|
||||
After the split, `ftdetect/scl.vim` will live in `tia-lsp.nvim`. Currently required in Neovim config:
|
||||
```vim
|
||||
au BufRead,BufNewFile *.scl set filetype=scl
|
||||
au BufRead,BufNewFile *.udt set filetype=scl
|
||||
au BufRead,BufNewFile *.db set filetype=scl
|
||||
```
|
||||
|
||||
## Code Style Guidelines
|
||||
|
||||
@@ -106,13 +76,10 @@ return M
|
||||
- Booleans: prefix with `is_`, `has_` (e.g., `is_udt`, `has_members`)
|
||||
|
||||
### Imports
|
||||
- `lua/tia/` modules: `require("tia.module_name")`
|
||||
- `lua/tia_lsp/` entry: `require("tia_lsp")`
|
||||
- `src/` modules: `dofile(script_path .. "/module.lua")`
|
||||
- External dependencies: wrap in `pcall()` for safety
|
||||
|
||||
### Code Formatting
|
||||
- `lua/tia/` and `lua/tia_lsp/`: 2 spaces indentation
|
||||
- `src/`: tab-based indentation
|
||||
- Max line length: 120 characters
|
||||
- No trailing whitespace
|
||||
@@ -190,6 +157,5 @@ Use the reference project for testing:
|
||||
|
||||
Contains `.scl`, `.db`, `.udt`, and `.xml` files for comprehensive testing of:
|
||||
- LSP features (hover, completion, go-to-definition)
|
||||
- Formatter (`:SCLFormat`)
|
||||
- Attribute block toggle
|
||||
- Formatter
|
||||
- Workspace type scanning
|
||||
|
||||
Reference in New Issue
Block a user