From 6b0417fea8110ffbb804df80d99cab48f90bf433 Mon Sep 17 00:00:00 2001 From: InSync Date: Fri, 20 Sep 2024 11:51:25 +0700 Subject: [PATCH] Avoid running Ruff on `.rst` files (#5, #6) --- src/main/kotlin/insyncwithfoo/ryecharm/PathsAndFiles.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/insyncwithfoo/ryecharm/PathsAndFiles.kt b/src/main/kotlin/insyncwithfoo/ryecharm/PathsAndFiles.kt index 020062a9..0955f5e8 100644 --- a/src/main/kotlin/insyncwithfoo/ryecharm/PathsAndFiles.kt +++ b/src/main/kotlin/insyncwithfoo/ryecharm/PathsAndFiles.kt @@ -96,6 +96,11 @@ internal val VirtualFile.isRuffToml: Boolean get() = name == "ruff.toml" || name == ".ruff.toml" +// https://github.com/InSyncWithFoo/ryecharm/issues/5 +private val PsiFile.isReST: Boolean + get() = virtualFile?.extension == "rst" + + // TODO: .ipynb / Allow configuring what files internal fun VirtualFile.isSupportedByRuff(project: Project? = null): Boolean { return extension == "py" || extension == "pyi" @@ -103,4 +108,4 @@ internal fun VirtualFile.isSupportedByRuff(project: Project? = null): Boolean { internal val PsiFile.isSupportedByRuff: Boolean - get() = this is PyFile || virtualFile?.isSupportedByRuff(project) == true + get() = this is PyFile && !this.isReST || virtualFile?.isSupportedByRuff(project) == true