Skip to content

LSP helper for ruff - an extremely fast Python linter, written in Rust.

License

Notifications You must be signed in to change notification settings

sublimelsp/LSP-ruff

Repository files navigation

LSP-ruff

This is a helper package that automatically installs and updates ruff for you. Ruff is an extremely fast Python linter and code transformation tool, written in Rust.

Requirements

To use this package, you must have:

  • An executable python (on Windows) or python3 (on Linux/macOS)
  • The LSP package
  • For Ubuntu and Debian users, you must also install python3-venv with apt
  • It's recommended to also install the LSP-json package which will provide auto-completion and validation for this package's settings.

Configuration

There are multiple ways to configure the package and the language server.

  • Global configuration: Preferences > Package Settings > LSP > Servers > LSP-ruff

  • Project-specific configuration: From the Command Palette run Project: Edit Project and add your settings in:

     {
     	"settings": {
     		"LSP": {
     			"LSP-ruff": {
     				"initializationOptions": {
     					"settings": {
     						// Put your settings here
     					}
     				}
     			}
     		}
     	}
     }

Code Actions on Save

The following "code actions on save" are supported:

  • source.fixAll
  • source.organizeImports
  • source.fixAll.ruff
  • source.organizeImports.ruff

You can use those with the lsp_code_actions_on_save LSP Setting to automatically apply specific actions on saving the file.