File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/main/kotlin/com/github/biomejs/intellijbiome/extensions Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -29,12 +29,17 @@ private val configValidExtensions = listOf("json", "jsonc")
29
29
fun VirtualFile.isBiomeConfigFile (): Boolean =
30
30
configValidExtensions.map { " ${configName} .$it " }.contains(this .name)
31
31
32
- fun VirtualFile.findNearestBiomeConfig (root : VirtualFile ? = null): VirtualFile ? =
33
- this .findNearestFile(root) {
34
- if (it .isBiomeConfigFile()) {
32
+ fun VirtualFile.findNearestBiomeConfig (root : VirtualFile ? = null, onlyRootConfig : Boolean = true ): VirtualFile ? =
33
+ this .findNearestFile(root) { file ->
34
+ if (file .isBiomeConfigFile()) {
35
35
// Skip biome.json(c) files that includes `root: false` or `extends: //`
36
- BiomeConfig .loadFromFile(it )?.isRootConfig() ? : false
36
+ BiomeConfig .loadFromFile(file )?.let { ! onlyRootConfig || it. isRootConfig() } ? : false
37
37
} else {
38
38
false
39
39
}
40
+ } ? : if (onlyRootConfig) {
41
+ // If no root config was found, fallback to any nearest nested (child) config.
42
+ this .findNearestBiomeConfig(root, false )
43
+ } else {
44
+ null
40
45
}
You can’t perform that action at this time.
0 commit comments