This guide will help you set up Visual Studio Code with proper linting and formatting for the Seed-X Translation project.
-
Install recommended extensions (VS Code will prompt you automatically):
- Python
- Ruff (modern replacement for flake8 + black)
- JSON Language Features
- YAML
- PowerShell
- Jupyter
-
Open the project in VS Code - settings are already configured!
- Linting: Real-time code quality checks
- Formatting: Automatic code formatting on save
- Import sorting: Automatic import organization
- Error fixing: Automatic fixes for common issues
- Line length: 127 characters (shown with ruler)
- Tab size: 4 spaces
- Auto-formatting: On save
- Trailing whitespace: Automatically trimmed
- Final newline: Automatically added
- Save file → Code is automatically formatted and imports organized
- Type code → Real-time linting shows errors and warnings
- Hover over errors → See detailed explanations and suggested fixes
Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run:
Ruff: Fix all auto-fixable problems- Fix all issues that can be automatically resolvedRuff: Format document- Format the current filePython: Select Interpreter- Choose the virtual environment
Shift+Alt+F- Format documentCtrl+Shift+O- Organize importsF8- Go to next error/warningShift+F8- Go to previous error/warning
The project includes these configuration files:
- VS Code workspace settings
- Ruff integration
- Python interpreter path
- Editor preferences
- Ruff configuration (linting rules, formatting options)
- Project metadata
- Tool settings for black, isort compatibility
- Recommended extensions list
- VS Code will prompt to install missing extensions
- Install the Ruff extension:
charliermarsh.ruff - Reload VS Code window:
Ctrl+Shift+P→ "Developer: Reload Window" - Check Python interpreter:
Ctrl+Shift+P→ "Python: Select Interpreter"
- Make sure virtual environment is activated
- Select correct interpreter:
Ctrl+Shift+P→ "Python: Select Interpreter" - Choose:
./venv/Scripts/python.exe(Windows) or./venv/bin/python(Linux/Mac)
Edit pyproject.toml to adjust Ruff rules:
[tool.ruff.lint]
ignore = [
"E203", # Add more rules to ignore
"W503",
"E501",
]- Consistent code style across the project
- Early error detection before running code
- Automatic formatting saves time
- Import organization keeps code clean
- Same formatting for all contributors
- Consistent linting rules reduce review time
- Automatic fixes reduce manual work
- Professional code quality
We use Ruff instead of the traditional flake8 + black + isort combination because:
- 10-100x faster than flake8
- Single tool replaces multiple tools
- Better error messages with suggestions
- Modern Python support (3.10+)
- Active development and maintenance
- Fix all Ruff warnings before committing
- Use type hints where possible
- Write descriptive docstrings
- Keep functions focused and small
- Use
Ctrl+Clickto navigate to definitions - Use
F12to go to definition - Use
Shift+F12to find all references - Use
Ctrl+Spacefor auto-completion
- VS Code shows git changes in the sidebar
- Use built-in git commands or terminal
- Review changes before committing
- Write descriptive commit messages
- Ruff Documentation: https://docs.astral.sh/ruff/
- VS Code Python: https://code.visualstudio.com/docs/python/python-tutorial
- Project Issues: https://github.com/Azornes/TranslatorSeedX/issues