File tree Expand file tree Collapse file tree
kotlin/insyncwithfoo/ryecharm
test/kotlin/insyncwithfoo/ryecharm/configurations/main Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ private val Project.pythonSDK: Sdk?
7676 * @see isUV
7777 */
7878internal val Project .sdkIsUV: Boolean
79- get() = pythonSDK?.isUV == true
79+ get() = pythonSDK?.isUV == true || modules.singleOrNull()?.sdkIsUV == true
8080
8181
8282internal val Project .path: Path ?
Original file line number Diff line number Diff line change @@ -8,6 +8,9 @@ import insyncwithfoo.ryecharm.configurations.SettingName
88internal class MainConfigurations : DisplayableState () {
99 var languageInjectionPEP723Blocks by property(true )
1010 var languageInjectionRequirements by property(true )
11+
12+ var suppressIncorrectNIRI by property(true )
13+ var suppressIncorrectNIRINonUVSDK by property(false )
1114}
1215
1316
Original file line number Diff line number Diff line change @@ -26,6 +26,14 @@ private fun Row.languageInjectionRequirementsInput(block: Cell<JBCheckBox>.() ->
2626 checkBox(message(" configurations.main.languageInjectionRequirements.label" )).apply (block)
2727
2828
29+ private fun Row.suppressIncorrectNIRIInput (block : Cell <JBCheckBox >.() -> Unit ) =
30+ checkBox(message(" configurations.main.suppressIncorrectNIRI.label" )).apply (block)
31+
32+
33+ private fun Row.suppressIncorrectNIRINonUVSDKInput (block : Cell <JBCheckBox >.() -> Unit ) =
34+ checkBox(message(" configurations.main.suppressIncorrectNIRINonUVSDK.label" )).apply (block)
35+
36+
2937@Suppress(" DialogTitleCapitalization" )
3038private fun MainPanel.makeComponent () = panel {
3139 group(message(" configurations.main.groups.languageInjection" )) {
@@ -38,6 +46,19 @@ private fun MainPanel.makeComponent() = panel {
3846 overrideCheckbox(state::languageInjectionRequirements)
3947 }
4048 }
49+
50+ group(message(message(" configurations.main.groups.inspections" ))) {
51+ row {
52+ suppressIncorrectNIRIInput { bindSelected(state::suppressIncorrectNIRI) }
53+ overrideCheckbox(state::suppressIncorrectNIRI)
54+ }
55+ indent {
56+ row {
57+ suppressIncorrectNIRINonUVSDKInput { bindSelected(state::suppressIncorrectNIRINonUVSDK) }
58+ overrideCheckbox(state::suppressIncorrectNIRINonUVSDK)
59+ }
60+ }
61+ }
4162}
4263
4364
Original file line number Diff line number Diff line change @@ -29,8 +29,6 @@ internal class UVConfigurations : DisplayableState() {
2929
3030 var retrieveDependenciesInReadAction by property(false )
3131 var dependenciesDataMaxAge by property(5 )
32- var suppressIncorrectNIRI by property(true )
33- var suppressIncorrectNIRINonUVSDK by property(false )
3432}
3533
3634
Original file line number Diff line number Diff line change @@ -73,14 +73,6 @@ private fun Row.dependenciesDataMaxAgeInput(block: Cell<JBIntSpinner>.() -> Unit
7373 spinner(0 .. 1_000_000 ).apply (block)
7474
7575
76- private fun Row.suppressIncorrectNIRIInput (block : Cell <JBCheckBox >.() -> Unit ) =
77- checkBox(message(" configurations.uv.suppressIncorrectNIRI.label" )).apply (block)
78-
79-
80- private fun Row.suppressIncorrectNIRINonUVSDKInput (block : Cell <JBCheckBox >.() -> Unit ) =
81- checkBox(message(" configurations.uv.suppressIncorrectNIRINonUVSDK.label" )).apply (block)
82-
83-
8476@Suppress(" DialogTitleCapitalization" )
8577private fun UVPanel.makeComponent () = panel {
8678
@@ -144,17 +136,6 @@ private fun UVPanel.makeComponent() = panel {
144136 dependenciesDataMaxAgeInput { bindIntValue(state::dependenciesDataMaxAge) }
145137 overrideCheckbox(state::dependenciesDataMaxAge)
146138 }
147-
148- row {
149- suppressIncorrectNIRIInput { bindSelected(state::suppressIncorrectNIRI) }
150- overrideCheckbox(state::suppressIncorrectNIRI)
151- }
152- indent {
153- row {
154- suppressIncorrectNIRINonUVSDKInput { bindSelected(state::suppressIncorrectNIRINonUVSDK) }
155- overrideCheckbox(state::suppressIncorrectNIRINonUVSDK)
156- }
157- }
158139 }
159140
160141}
Original file line number Diff line number Diff line change 1- package insyncwithfoo.ryecharm.uv.suppressors
2-
1+ package insyncwithfoo.ryecharm.others.suppressors
32
43import com.intellij.codeInspection.InspectionSuppressor
54import com.intellij.codeInspection.SuppressQuickFix
@@ -8,7 +7,7 @@ import com.intellij.psi.PsiElement
87import com.jetbrains.python.requirements.inspections.tools.NotInstalledRequirementInspection
98import insyncwithfoo.ryecharm.TOMLPath
109import insyncwithfoo.ryecharm.absoluteName
11- import insyncwithfoo.ryecharm.configurations.uv.uvConfigurations
10+ import insyncwithfoo.ryecharm.configurations.main.mainConfigurations
1211import insyncwithfoo.ryecharm.isPyprojectToml
1312import insyncwithfoo.ryecharm.sdkIsUV
1413import insyncwithfoo.ryecharm.stringArrayTomlKey
@@ -31,7 +30,7 @@ internal class UnsatisfiedRequirementInspectionSuppressor : InspectionSuppressor
3130 }
3231
3332 val (project, file) = Pair (element.project, element.containingFile.virtualFile)
34- val configurations = project.uvConfigurations
33+ val configurations = project.mainConfigurations
3534
3635 when {
3736 ! file.isPyprojectToml -> return false
Original file line number Diff line number Diff line change 8181 language=" TOML"
8282 implementationClass=" insyncwithfoo.ryecharm.others.installers.GutterInstallButtonsProvider"
8383 />
84+
85+ <lang .inspectionSuppressor
86+ id=" insyncwithfoo.ryecharm.others.suppressors.UnsatisfiedRequirementInspectionSuppressor"
87+ language=" TOML"
88+ implementationClass=" insyncwithfoo.ryecharm.others.suppressors.UnsatisfiedRequirementInspectionSuppressor"
89+ />
8490 </extensions >
8591
8692 <extensions defaultExtensionNs =" JavaScript" >
Original file line number Diff line number Diff line change 6666 id=" insyncwithfoo.ryecharm.uv.actions.Install"
6767 implementation=" insyncwithfoo.ryecharm.uv.actions.Install"
6868 />
69-
70- <lang .inspectionSuppressor
71- id=" insyncwithfoo.ryecharm.uv.suppressors.UnsatisfiedRequirementInspectionSuppressor"
72- language=" TOML"
73- implementationClass=" insyncwithfoo.ryecharm.uv.suppressors.UnsatisfiedRequirementInspectionSuppressor"
74- />
7569 </extensions >
7670
7771 <extensions defaultExtensionNs =" com.intellij" >
Original file line number Diff line number Diff line change @@ -28,10 +28,17 @@ configurations.groups.advanced = Advanced settings
2828configurations.main.displayName = RyeCharm
2929
3030configurations.main.groups.languageInjection = Language injection
31+ configurations.main.groups.inspections = Inspections
3132
3233configurations.main.languageInjectionPEP723Blocks.label = PEP 723 script metadata blocks
3334configurations.main.languageInjectionRequirements.label = Requirements arrays in TOML files
3435
36+ configurations.main.suppressIncorrectNIRI.label = \
37+ <html> \
38+ Suppress <code>UnsatisfiedRequirementInspection</code> for <code>build-system.requires</code> \
39+ </html>
40+ configurations.main.suppressIncorrectNIRINonUVSDK.label = Even when the interpreter is not uv-based
41+
3542# ####################################### endregion
3643
3744# ####################################### region ## Ruff
@@ -154,10 +161,6 @@ configurations.uv.retrieveDependenciesInReadAction.label = \
154161 Retrieve data for computing dependency version inlay hints in read action
155162configurations.uv.dependenciesDataMaxAge.label = Dependencies data's max age (seconds):
156163
157- configurations.uv.suppressIncorrectNIRI.label = \
158- Suppress <code>UnsatisfiedRequirementInspection</code> for <code>build-system.requires</code>
159- configurations.uv.suppressIncorrectNIRINonUVSDK.label = Even when the SDK is not uv-based
160-
161164# ####################################### endregion
162165
163166# ####################################### region ## ty
Original file line number Diff line number Diff line change @@ -11,9 +11,12 @@ internal class MainConfigurationsTest : ConfigurationsTest<MainConfigurations>()
1111
1212 @Test
1313 fun `test shape` () {
14- doShapeTest(expectedSize = 2 ) {
14+ doShapeTest(expectedSize = 4 ) {
1515 assertEquals(true , languageInjectionPEP723Blocks)
1616 assertEquals(true , languageInjectionRequirements)
17+
18+ assertEquals(true , suppressIncorrectNIRI)
19+ assertEquals(false , suppressIncorrectNIRINonUVSDK)
1720 }
1821 }
1922
You can’t perform that action at this time.
0 commit comments