Consider --preview flag for server subcommand by dhruvmanila · Pull Request #12208 · astral-sh/ruff (original) (raw)

Summary

This PR removes the requirement of --preview flag to run the ruff server and instead considers it to be an indicator to turn on preview mode for the linter and the formatter.

resolves: #12161

Test Plan

Add test cases to assert the preview value is updated accordingly.

In an editor context, I used the local ruff executable in Neovim with the --preview flag and verified that the preview-only violations are being highlighted.

Running with:

require('lspconfig').ruff.setup({ cmd = { '/Users/dhruv/work/astral/ruff/target/debug/ruff', 'server', '--preview', }, })

The screenshot shows that E502 is highlighted with the below config in pyproject.toml:

Screenshot 2024-07-17 at 16 43 09