Skip to content

Commit 08ab30f

Browse files
authored
fix: support project structure with multiple roots (#197)
1 parent 290dbd5 commit 08ab30f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/kotlin/com/github/biomejs/intellijbiome/lsp/BiomeLspServerSupportProvider.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ import com.github.biomejs.intellijbiome.settings.BiomeConfigurable
66
import com.github.biomejs.intellijbiome.settings.BiomeSettings
77
import com.intellij.execution.configurations.GeneralCommandLine
88
import com.intellij.execution.process.OSProcessHandler
9+
import com.intellij.openapi.project.BaseProjectDirectories.Companion.getBaseDirectories
910
import com.intellij.openapi.project.Project
10-
import com.intellij.openapi.project.guessProjectDir
11+
import com.intellij.openapi.vfs.VfsUtil
1112
import com.intellij.openapi.vfs.VirtualFile
1213
import com.intellij.platform.lsp.api.LspServer
1314
import com.intellij.platform.lsp.api.LspServerDescriptor
@@ -31,7 +32,10 @@ import org.eclipse.lsp4j.ConfigurationItem
3132

3233
// Finds the root directory of a Biome workspace. It's typically the parent directory of `biome.json`.
3334
// If no `biome.json` file found, nothing to do.
34-
val projectRootDir = project.guessProjectDir() ?: return
35+
val projectRootDir = project
36+
.getBaseDirectories()
37+
.find { VfsUtil.isUnder(file, setOf(it)) } ?: return
38+
3539
val root = if (configPath.isNullOrEmpty()) {
3640
file.findNearestBiomeConfig(projectRootDir)?.parent ?: return
3741
} else {

0 commit comments

Comments
 (0)