sublimelsp / LSP-ruff

LSP helper for ruff - an extremely fast Python linter, written in Rust.
https://packagecontrol.io/packages/LSP-ruff
MIT License
26 stars 4 forks source link

How to set max number of characters per line? #44

Closed vgoklani closed 7 months ago

vgoklani commented 8 months ago

Hey there,

I just did the update on sublime for ruff-lsp, thank you for the black integration!

I noticed that my code now goes beyond the usual 88 characters. I previously used

https://github.com/thep0y/python-black

which automatically rewrote my python code if it extended beyond the limit. Is there a setting in ruff for this? thanks!

rchl commented 7 months ago

Probably best way to configure this is through configuration files in your project. See awesome ruff documentation like https://docs.astral.sh/ruff/formatter/

vgoklani commented 7 months ago

thanks @rchl

where should that file be located?

Shouldn't the settings be in: Settings -> Package Settings -> LSP -> Servers -> LSP-ruff ?

LDAP commented 7 months ago

It's placed in the project root. See https://docs.astral.sh/ruff/formatter/#configuration

rchl commented 7 months ago

And you can also do that globally from LSP-ruff settings. Just look on the left column after opening settings and match that structure in your local configuration, adding format options as needed.