Inintal commit
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
# AGENTS.md - SCL Language Server (Unified)
|
||||
|
||||
This is a unified Neovim/LazyVim plugin for Siemens SCL language support.
|
||||
|
||||
## Project Overview
|
||||
|
||||
The unified `scl_lsp` project provides:
|
||||
- **LSP Server** - Language Server Protocol implementation
|
||||
- **Linter** - Diagnostics and code validation
|
||||
- **Formatter** - Document formatting
|
||||
- **Syntax Highlighting** - Tree-sitter based
|
||||
- **Auto-completion** - blink.cmp integration
|
||||
- **Auto-prefix** - Automatic `#` prefixing for variables
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
scl_lsp/
|
||||
├── src/ # LSP server implementation
|
||||
│ ├── main.lua # Entry point, protocol handling
|
||||
│ ├── parser.lua # Regex-based SCL parser
|
||||
│ ├── treesitter.lua # Tree-sitter integration
|
||||
│ ├── diagnostics.lua # Linter diagnostics
|
||||
│ ├── formatter.lua # Document formatter
|
||||
│ ├── json.lua # JSON encoder/decoder
|
||||
│ └── plc_json.lua # External UDT loading
|
||||
├── lua/
|
||||
│ ├── scl/ # Neovim plugin modules (from scl_syntax_nvim)
|
||||
│ │ ├── init.lua
|
||||
│ │ ├── auto_prefix.lua
|
||||
│ │ ├── blink_cmp_source.lua
|
||||
│ │ ├── fb_parser.lua
|
||||
│ │ ├── udt_parser.lua
|
||||
│ │ ├── variables.lua
|
||||
│ │ └── workspace_types.lua
|
||||
│ └── scl_lsp/
|
||||
│ ├── init.lua # Unified plugin setup
|
||||
│ └── plugins/
|
||||
│ └── scl.lua # LazyVim plugin spec
|
||||
├── queries/ # Tree-sitter queries
|
||||
│ ├── highlights.scm
|
||||
│ ├── indents.scm
|
||||
│ ├── folds.scm
|
||||
│ ├── locals.scm
|
||||
│ └── tags.scm
|
||||
├── grammar.js # Tree-sitter grammar
|
||||
└── tree-sitter.json # Parser config
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Running the LSP Server
|
||||
|
||||
```bash
|
||||
# Direct execution
|
||||
lua src/main.lua
|
||||
|
||||
# Via shell script
|
||||
./scl_lsp.sh
|
||||
|
||||
# With test mode
|
||||
lua src/main.lua --test
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
```bash
|
||||
# Tree-sitter parser
|
||||
npm test
|
||||
tree-sitter generate
|
||||
|
||||
# Test file parsing
|
||||
tree-sitter parse corpus/test/main_org_block.scl
|
||||
```
|
||||
|
||||
### Key Patterns
|
||||
|
||||
- **LSP Protocol**: JSON-RPC over stdin/stdout in `src/main.lua`
|
||||
- **Diagnostics**: `src/diagnostics.lua` - validates SCL code
|
||||
- **Formatter**: `src/formatter.lua` - formats SCL documents
|
||||
- **Syntax**: Tree-sitter queries in `queries/`
|
||||
- **Plugin Setup**: `lua/scl_lsp/init.lua` - LazyVim integration
|
||||
|
||||
## Configuration
|
||||
|
||||
See `README.md` for configuration options and usage.
|
||||
Reference in New Issue
Block a user