mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 05:14:52 +00:00
include .pyw
files by default when linting and formatting (#20458)
- Adds test cases exercising file selection by extension with `--preview` enabled and disabled. - Adds `INCLUDE_PREVIEW` with file patterns including `*.pyw`. - In global preview mode, default configuration selects patterns from `INCLUDE_PREVIEW`. - Manually tested ruff server with local vscode for both formatting and linting of a `.pyw` file. Closes https://github.com/astral-sh/ruff/issues/13246
This commit is contained in:
parent
fcc76bb7b2
commit
83f80effec
7 changed files with 535 additions and 7 deletions
|
@ -78,7 +78,9 @@ pub enum TomlSourceType {
|
|||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub enum PySourceType {
|
||||
/// The source is a Python file (`.py`).
|
||||
/// The source is a Python file (`.py`, `.pyw`).
|
||||
/// Note: `.pyw` files contain Python code, but do not represent importable namespaces.
|
||||
/// Consider adding a separate source type later if combining the two causes issues.
|
||||
#[default]
|
||||
Python,
|
||||
/// The source is a Python stub file (`.pyi`).
|
||||
|
@ -100,6 +102,7 @@ impl PySourceType {
|
|||
let ty = match extension {
|
||||
"py" => Self::Python,
|
||||
"pyi" => Self::Stub,
|
||||
"pyw" => Self::Python,
|
||||
"ipynb" => Self::Ipynb,
|
||||
_ => return None,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue