A modern Language Server Protocol (LSP) implementation for the PSeInt programming language
Bringing modern IDE features to PSeInt development โจ
- Automatic indentation and spacing
- Proper keyword casing
- Consistent code style
- Lightning-fast Ruff linting
- Pyright type checking
- Pre-commit hooks
- Comprehensive test suite
- Coverage reporting
- CI/CD automation
- One-command installation
- Cross-platform support
- Zero configuration
- Context-aware auto-completion for keywords, variables, and functions.
- Helpful code snippets for common PSeInt structures.
- Rich hover information for symbols (variable types, function signatures).
- Parameter signature help for functions and subprocesos during calls.
๐ Editor Support: Neovim โข VS Code โข More coming soon...
| ๐ค User Path | ๐ ๏ธ Developer Path |
|---|---|
| Goal: Use PSeInt LSP in your editor | Goal: Contribute to the project |
| Time: ~5 minutes | Time: ~10 minutes |
| Requirements: Python 3.8+ | Requirements: Python 3.8+, Node.js, make |
| Next Step: Installation for Users | Next Step: Installation for Developers |
graph LR
A[๐ฅ Install] --> B[โ๏ธ Configure Editor]
B --> C[๐ Open .psc file]
C --> D[โจ Enjoy LSP features!]
style A fill:#e1f5fe
style B fill:#f3e5f5
style C fill:#e8f5e8
style D fill:#fff3e0
๐ฏ Ready to start? Pick your path above and let's get you set up with modern PSeInt development!
๐ฏ Perfect for: Developers who want to use PSeInt LSP in their editor
๐ Prerequisites:
- ๐ Python 3.8+
โก Quick Setup:
# ๐ฅ Clone the repository
git clone <repository-url>
cd pseint-lsp
# ๐ง Create virtual environment and install dependencies
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt๐ฏ Next Steps:
- ๐ Note the installation path: You'll need the full path to this directory for your editor configuration
- โ๏ธ Configure your editor: Follow the Editor Integration section below to set up the LSP in Neovim, VS Code, or your preferred editor
- ๐ Start coding: Open a
.pscfile and enjoy automatic formatting and LSP features!
๐ก Pro Tip: The LSP server runs automatically when you open PSeInt files in your configured editor. You don't need to start it manually!
๐ฏ Perfect for: Contributors who want to modify or enhance the project
๐ Prerequisites:
- ๐ Python 3.8+
- ๐ข Node.js (for Pyright type checker)
- โ๏ธ
make(for development automation)
๐ Quick Development Setup:
# ๐ฅ Clone and setup everything
git clone <repository-url>
cd pseint-lsp
./setup-dev.sh
# ๐ ๏ธ Start developing
make dev # Run the LSP server
make test # Run tests
make help # See all available commands๐ง Manual Development Setup:
# โ๏ธ Set up development environment
make setup
source .venv/bin/activate
make infoโก Development Commands:
| Command | Description | Use Case |
|---|---|---|
make help |
๐ Show all available commands | Getting started |
make dev |
๐ Install deps + run server | Development |
make test |
๐งช Run all tests | Testing |
make lint |
๐ Run linting (Ruff + Pyright) | Code quality |
make format |
โจ Format code with Ruff | Code style |
make fix |
๐ง Auto-fix code issues | Quick fixes |
make pre-commit |
โ Fix + lint + test (before committing) | Pre-commit |
๐ For Users: This is your next step after installation. Configure your editor to automatically use the PSeInt LSP when editing
.pscfiles.
-- Set up filetype detection
vim.filetype.add({
extension = { psc = 'pseint' },
})
-- Configure PSeInt LSP
vim.lsp.config('pseint-lsp', {
cmd = { '/path/to/pseint-lsp/.venv/bin/python', '/path/to/pseint-lsp/launch.py' },
filetypes = { 'pseint' },
root_markers = { '.git', 'proyecto.psc' },
name = 'pseint-lsp',
})
-- Enable the LSP
vim.lsp.enable('pseint-lsp')Create ~/.config/nvim/lsp/pseint-lsp.lua:
return {
cmd = { '/path/to/pseint-lsp/.venv/bin/python', '/path/to/pseint-lsp/launch.py' },
filetypes = { 'pseint' },
root_markers = { '.git', 'proyecto.psc' },
name = 'pseint-lsp',
}Then in your init.lua:
vim.filetype.add({ extension = { psc = 'pseint' } })
vim.lsp.enable('pseint-lsp')๐ง In Development: A VS Code extension for PSeInt LSP is planned for future release. This will provide one-click installation from the VS Code marketplace.
For now, advanced users can manually configure the LSP using a VS Code extension that supports generic LSP servers:
๐ฆ Step 1: Install a generic LSP client extension:
- Install vscode-languageclient or
- Install Generic LSP Client
โ๏ธ Step 2: Configure in VS Code settings.json:
{
"files.associations": {
"*.psc": "pseint"
},
"files.autoGuessEncoding": true,
"languageserver": {
"pseint": {
"command": "/path/to/pseint-lsp/.venv/bin/python",
"args": ["/path/to/pseint-lsp/launch.py"],
"filetypes": ["pseint"],
"rootPatterns": [".git", "proyecto.psc"]
}
}
}
โ ๏ธ Important: This manual approach requires technical knowledge and may not work reliably. We recommend waiting for the official VS Code extension or using Neovim for the best experience.
Regardless of the method used, configure VS Code for PSeInt file encoding:
{
"files.autoGuessEncoding": true
}๐ง Troubleshooting: If you see corrupted characters, manually reopen files with "Western (ISO 8859-1)" encoding via Command Palette โ "Reopen Editor With Encoding".
Once configured with your editor, the LSP provides powerful code formatting and navigation for PSeInt files.
| Action | Neovim | VS Code | Description |
|---|---|---|---|
| Format Document | <leader>lf |
Shift+Alt+F |
Format entire file |
| Auto-format on save | Configure in settings | Configure in settings | Automatic formatting |
| Manual formatting | :lua vim.lsp.buf.format() |
Command Palette | On-demand formatting |
| Keybinding | Action | Description |
|---|---|---|
grn |
๐ท๏ธ Rename symbol | Rename variables/functions across files |
gra |
โก Code actions | Quick fixes and refactoring |
grr |
๐ Show references | Find all symbol usages |
gd |
๐ฏ Go to definition | Jump to symbol definition |
K |
๐ Hover Information | Show detailed information about the symbol under the cursor (e.g., type, definition, parameters). |
Ctrl+Space (Editor specific) |
๐ก Auto-completion | Get suggestions for keywords, variables, functions, and snippets relevant to the current context. |
( or , (in function call) |
โน๏ธ Signature Help | See parameter information for functions and subprocesos as you type. |
๐ก Pro Tip: These features work automatically once your editor is configured. Just open a
.pscfile and start coding!
PSeInt uses ISO-8859-1 (Latin-1) encoding by default, with full support for Spanish characters:
Supported Characters:
- ๐ค Accented vowels:
รก,รฉ,รญ,รณ,รบ - ๐ค Special characters:
รฑ,ยฟ,ยก,รผ
VS Code - Enable auto-encoding detection:
{
"files.autoGuessEncoding": true
}๐ง Troubleshooting: If you see corrupted characters, manually reopen files with "Western (ISO 8859-1)" encoding.
๐ Compatibility Check:
- โ UTF-8 files: Fully supported
- โ ISO-8859-1 files: Supported with proper editor configuration
โ ๏ธ Mixed encoding: Use consistent encoding across project files
โโโ ๐ server.py # Main LSP server
โโโ โจ formatter.py # PSeInt formatting logic
โโโ ๐ง launch.py # Server launcher script
โโโ โ๏ธ Makefile # Development automation
โโโ ๐ฆ requirements.txt # Production dependencies
โโโ ๐งช requirements-dev.txt # Development dependencies
โโโ ๐งช tests/ # Test suite
โโโ ๐ docs/ # Documentation
The formatter implements comprehensive PSeInt formatting with precision:
- ๐ค Keywords: Proper casing (
procesoโProceso,finsiโFinSi) - ๐ Indentation: 4-space indentation for code blocks
- ๐ฏ Spacing: Normalized spacing around operators and keywords
- ๐ Blank Lines: Removes excessive blank lines and trailing whitespace
- ๐ฌ Comments: Preserves comments with proper spacing
# Run all tests
make test
# Run with coverage
make test-cov
# Run specific tests
python -m pytest tests/test_formatter.py -v
# Watch mode (auto-restart on changes)
make test-watchModern tooling for development excellence:
- ๐ Ruff: Fast linting and formatting
- ๐ Pyright: Static type checking
- ๐งช Pytest: Testing framework with async support
- ๐ Pre-commit: Git hooks for code quality
The LSP server is built using modern Python practices:
- ๐ก pygls: Python LSP server framework
- โก asyncio: Asynchronous I/O for LSP communication
- ๐งฉ Modular design: Separate formatter and server components
- โ Comprehensive testing: Unit, integration, and end-to-end tests
Contributions are welcome! This project follows modern Python development practices.
-
๐ด Fork and clone the repository
-
โ๏ธ Set up development environment:
make setup source .venv/bin/activate -
๐ Install pre-commit hooks:
pre-commit install
# Make your changes, then run quality checks
make fix # ๐ง Auto-fix code style issues
make lint # ๐ Check code quality
make test # ๐งช Run tests
make pre-commit # โ
Full pre-commit check- ๐ Create a feature branch for your changes
- ๐งช Add tests for new functionality
- ๐ Update documentation if necessary
- โ
Run quality checks:
make pre-commit - ๐งช Ensure all tests pass:
make test - ๐ท๏ธ Add type hints to new Python code
- ๐จ Follow existing code style (automatically enforced by Ruff)
๐ฏ VS Code Extension Development:
- Help needed for creating a proper VS Code extension
- Knowledge of TypeScript and VS Code extension API beneficial
- Will significantly improve user experience
๐ Additional LSP Features:
- Diagnostics and error reporting
- Auto-completion and IntelliSense
- Symbol navigation and refactoring
๐ Editor Integrations:
- Configurations for other editors (Vim, Emacs, Sublime Text)
- Testing and validation across different platforms
The project is designed to be easily extensible for additional LSP features:
- ๐ Diagnostics: Real-time syntax error detection and reporting.
- โช๏ธ Find References: Find all usages of a symbol across a project (if applicable to PSeInt usage).
- ๐ ๏ธ Advanced Refactoring Tools: More sophisticated refactoring options beyond basic symbol rename.
- ๐งฉ Cross-File Analysis: (For users who might structure larger PSeInt projects across multiple files) Support for understanding symbols and dependencies across different files in a project.
A dedicated VS Code extension is planned that will provide:
- ๐ฏ One-click installation from VS Code marketplace
- ๐ค Automatic LSP server management (no manual setup required)
- ๐จ PSeInt syntax highlighting and theme support
- ๐ Integrated debugging and error reporting
- ๐ File templates for new PSeInt projects
๐ Timeline: VS Code extension development is planned for the next major release. Contributors welcome!
Future editor integrations planned:
- ๐ Vim/Neovim: Enhanced configuration and features
- ๐ฏ Emacs: LSP client configuration
- โจ Sublime Text: LSP plugin support
- ๐ง IntelliJ IDEA: Plugin development
See LICENSE file for details.
A modern IDE experience for PSeInt development
โญ Star this project | ๐ Report Bug | ๐ก Request Feature