Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
9097: CARGO: support IDEs without `Build Tools` settings r=mchernyavsky a=Undin Rider doesn't provide `Build | Build Tools` settings. As a result, `Cargo` settings cannot be added as a child of `Build Tools` and the platform adds it to as a root setting panel The main idea is to keep `Cargo` settings under `Languages & Frameworks | Rust` if `Build | Build Tools` doesn't exist, and add `Build Tools` panel to `Cargo` settings. <img width="1094" alt="Screen Shot 2022-07-21 at 00 22 33" src="https://user-images.githubusercontent.com/2539310/180084602-e23cf2c6-eb36-42c1-bdd2-7eae88aadc36.png"> To achieve it, `CargoBuildToolConfigurableProvider` and `CargoProjectConfigurableProvider` were introduced since they provide more flexible way to manage when `CargoConfigurable` should be shown and how Fixes #9077 changelog: Properly add `Cargo` settings in Rider 2022.2 Co-authored-by: Arseniy Pendryak <a.pendryak@yandex.ru>
- Loading branch information
Showing
7 changed files
with
121 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,2 @@ | ||
<idea-plugin> | ||
<extensions defaultExtensionNs="com.intellij"> | ||
<projectConfigurable instance="org.rust.cargo.project.configurable.CargoConfigurable" | ||
parentId="language.rust" | ||
id="language.rust.cargo"/> | ||
</extensions> | ||
</idea-plugin> |
44 changes: 0 additions & 44 deletions
44
src/222/main/kotlin/org/rust/cargo/project/configurable/CargoPlaceholderConfigurable.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/kotlin/org/rust/cargo/project/configurable/CargoBuildToolConfigurableProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Use of this source code is governed by the MIT license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
package org.rust.cargo.project.configurable | ||
|
||
import com.intellij.openapi.application.ApplicationInfo | ||
import com.intellij.openapi.options.Configurable | ||
import com.intellij.openapi.options.ConfigurableProvider | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.util.BuildNumber | ||
|
||
class CargoBuildToolConfigurableProvider(private val project: Project) : ConfigurableProvider() { | ||
|
||
override fun canCreateConfigurable(): Boolean { | ||
return ApplicationInfo.getInstance().build >= BUILD_222 && CargoConfigurable.buildToolsConfigurableExists(project) | ||
} | ||
|
||
override fun createConfigurable(): Configurable = CargoConfigurable(project, isPlaceholder = false) | ||
|
||
companion object { | ||
// BACKCOMPAT: 2022.1 | ||
private val BUILD_222: BuildNumber = BuildNumber.fromString("222")!! | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/org/rust/cargo/project/configurable/CargoProjectConfigurableProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Use of this source code is governed by the MIT license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
package org.rust.cargo.project.configurable | ||
|
||
import com.intellij.openapi.application.ApplicationInfo | ||
import com.intellij.openapi.options.Configurable | ||
import com.intellij.openapi.options.ConfigurableProvider | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.util.BuildNumber | ||
|
||
class CargoProjectConfigurableProvider(private val project: Project) : ConfigurableProvider() { | ||
|
||
override fun createConfigurable(): Configurable { | ||
val isPlaceholder = ApplicationInfo.getInstance().build >= BUILD_222 && CargoConfigurable.buildToolsConfigurableExists(project) | ||
return CargoConfigurable(project, isPlaceholder) | ||
} | ||
|
||
companion object { | ||
// BACKCOMPAT: 2022.1 | ||
private val BUILD_222: BuildNumber = BuildNumber.fromString("222")!! | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters