Treat ty: comments as pragma comments (#18532)

## Summary

Add support for ty's `ty:` pragma comments to ruff's formatter and E501

Fixes https://github.com/astral-sh/ruff/issues/18529

## Test Plan

Added test
This commit is contained in:
Micha Reiser
2025-06-07 16:02:43 +02:00
committed by GitHub
parent 503427855d
commit b3b900dc1e
3 changed files with 4 additions and 2 deletions

View File

@@ -26,5 +26,5 @@ pub fn is_pragma_comment(comment: &str) -> bool {
// Case-sensitive match against a variety of pragmas that _do_ require a trailing colon.
trimmed
.split_once(':')
.is_some_and(|(maybe_pragma, _)| matches!(maybe_pragma, "isort" | "type" | "pyright" | "pylint" | "flake8" | "ruff"))
.is_some_and(|(maybe_pragma, _)| matches!(maybe_pragma, "isort" | "type" | "pyright" | "pylint" | "flake8" | "ruff" | "ty"))
}