A Language Server Protocol (LSP) implementation for VASP (Vienna Ab initio Simulation Package) input/output files.
VASP-LSP provides intelligent code editing features for VASP calculation input files:
- INCAR - Input parameters with autocomplete and validation
- POSCAR - Structure file syntax highlighting
- KPOINTS - K-point grid configuration
- 📝 Autocomplete - Smart completion for INCAR tags and values
- 📖 Hover Documentation - Instant access to VASP parameter documentation
⚠️ Diagnostics - Real-time error detection and warnings- ✨ Document Formatting - Format INCAR, POSCAR, and KPOINTS files
- 🔧 Quick Fixes - Automatic fixes for common issues (NEW)
pip install vasp-lspA VSCode extension is available in editors/vscode/. See the extension README for installation instructions.
vasp-lsp --stdiovasp-lsp --tcp --host 127.0.0.1 --port 2087require'lspconfig'.vasp_lsp.setup{}Provides intelligent completions for:
- INCAR parameter names
- Parameter values (enums, booleans)
- Context-aware suggestions
Hover over any INCAR parameter to see:
- Parameter description
- Valid values/range
- Default value
- Related parameters
Real-time validation including:
- Unknown parameter detection
- Value type checking
- Range validation
- Parameter dependency checks
- Common configuration warnings
Format your VASP input files:
- INCAR: Parameters grouped by category, aligned values
- POSCAR: Consistent coordinate precision, proper spacing
- KPOINTS: Normalized grid types, formatted k-point lists
Automatic fixes for common issues:
- Add missing SIGMA when ISMEAR >= 0
- Add missing MAGMOM when ISPIN = 2
- Add missing LDAU parameters
- Remove conflicting NPAR/NCORE
- Fix common tag typos
git clone https://github.com/newtontech/VASP-LSP.git
cd VASP-LSP
pip install -e ".[dev]"Run tests with:
pytest --cov=src/vasp_lsp --cov-report=term-missingTo verify current coverage, run the command above and check the TOTAL line in the report.
Coverage thresholds are enforced in CI (see .github/workflows/ci.yml).
The project maintains high code quality through:
- 100% test coverage - All code paths are tested
- Code cleanup - Dead code and unreachable branches removed
- Static analysis - Linting with Ruff
- Type hints - Full type annotations for better IDE support
MIT License
- Inspired by cp2k-language-server
- Built with pygls