Skip to content

icristianhernandez/pseint-lsp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

27 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ PSeInt Language Server

A modern Language Server Protocol (LSP) implementation for the PSeInt programming language

Python LSP License PRs Welcome

Bringing modern IDE features to PSeInt development โœจ


โœจ Features

Transform your PSeInt coding experience with modern IDE capabilities

๐Ÿ”ง Smart Code Formatting

  • Automatic indentation and spacing
  • Proper keyword casing
  • Consistent code style

๐Ÿš€ Modern Development

  • Lightning-fast Ruff linting
  • Pyright type checking
  • Pre-commit hooks

๐Ÿงช Quality Assurance

  • Comprehensive test suite
  • Coverage reporting
  • CI/CD automation

๐Ÿ“ฆ Easy Setup

  • One-command installation
  • Cross-platform support
  • Zero configuration

๐Ÿ’ก Enhanced Code Intelligence

  • 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...

๐Ÿš€ Quick Start

๐ŸŽฏ Choose Your Path

๐Ÿ‘ค 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

๏ฟฝ Workflow Overview

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
Loading

๐ŸŽฏ Ready to start? Pick your path above and let's get you set up with modern PSeInt development!

๐Ÿ“ฆ Installation

๐Ÿ‘ค For Users (LSP Usage)

๐ŸŽฏ 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:

  1. ๐Ÿ“ Note the installation path: You'll need the full path to this directory for your editor configuration
  2. โš™๏ธ Configure your editor: Follow the Editor Integration section below to set up the LSP in Neovim, VS Code, or your preferred editor
  3. ๐Ÿš€ Start coding: Open a .psc file 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!

๐Ÿ› ๏ธ For Developers (Contributing)

๐ŸŽฏ 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

๐Ÿ”Œ Editor Integration

๐Ÿ“ For Users: This is your next step after installation. Configure your editor to automatically use the PSeInt LSP when editing .psc files.

๐Ÿš€ Neovim

๐ŸŽฏ Option 1: Main configuration (init.lua)

-- 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')

๐Ÿ”ง Option 2: Dedicated configuration file

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')

๐Ÿ’ป VS Code

๐ŸŽฏ Option 1: VS Code Extension (Recommended - Coming Soon)

๐Ÿšง 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.

โš™๏ธ Option 2: Manual LSP Configuration (Advanced Users)

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:

โš™๏ธ 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.

๐Ÿ”ค Encoding Configuration

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".

๐ŸŽฏ Usage

Once configured with your editor, the LSP provides powerful code formatting and navigation for PSeInt files.

๐Ÿ“ Available Commands

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

๐Ÿ”ง LSP Features

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 .psc file and start coding!

๐ŸŒ File Encoding Support

๐Ÿ“„ PSeInt Encoding

PSeInt uses ISO-8859-1 (Latin-1) encoding by default, with full support for Spanish characters:

Supported Characters:

  • ๐Ÿ”ค Accented vowels: รก, รฉ, รญ, รณ, รบ
  • ๐Ÿ”ค Special characters: รฑ, ยฟ, ยก, รผ

โš™๏ธ Editor Configuration

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

๐Ÿ› ๏ธ Development

๐Ÿ“ Project Structure

โ”œโ”€โ”€ ๐Ÿš€ 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

๐Ÿ“ Formatting Rules

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

๐Ÿงช Testing

# 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-watch

๐ŸŽฏ Code Quality

Modern 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

๐Ÿ—๏ธ Architecture

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

๐Ÿค Contributing

Contributions are welcome! This project follows modern Python development practices.

๐Ÿš€ Development Setup

  1. ๐Ÿด Fork and clone the repository

  2. โš™๏ธ Set up development environment:

    make setup
    source .venv/bin/activate
  3. ๐Ÿ”— Install pre-commit hooks:

    pre-commit install

๐Ÿ”„ Development Workflow

# 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

๐Ÿ“‹ Pull Request Guidelines

  1. ๐ŸŒŸ Create a feature branch for your changes
  2. ๐Ÿงช Add tests for new functionality
  3. ๐Ÿ“š Update documentation if necessary
  4. โœ… Run quality checks: make pre-commit
  5. ๐Ÿงช Ensure all tests pass: make test
  6. ๐Ÿท๏ธ Add type hints to new Python code
  7. ๐ŸŽจ Follow existing code style (automatically enforced by Ruff)

โญ Special Contribution Areas

๐ŸŽฏ 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

๐Ÿ”ฎ Future Features

๐Ÿš€ Planned LSP Enhancements

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.

๐Ÿ“ฑ VS Code Extension

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!

๐ŸŒŸ Editor Support Expansion

Future editor integrations planned:

  • ๐Ÿš€ Vim/Neovim: Enhanced configuration and features
  • ๐ŸŽฏ Emacs: LSP client configuration
  • โœจ Sublime Text: LSP plugin support
  • ๐Ÿง  IntelliJ IDEA: Plugin development

๐Ÿ“„ License

See LICENSE file for details.


๐ŸŽฏ Made with โค๏ธ for the PSeInt community

A modern IDE experience for PSeInt development

GitHub stars GitHub forks

โญ Star this project | ๐Ÿ› Report Bug | ๐Ÿ’ก Request Feature

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages