|
|
@@ -1212,7 +1212,19 @@ export namespace LSPServer {
|
|
|
export const KotlinLS: Info = {
|
|
|
id: "kotlin-ls",
|
|
|
extensions: [".kt", ".kts"],
|
|
|
- root: NearestRoot(["build.gradle", "build.gradle.kts", "settings.gradle.kts", "pom.xml"]),
|
|
|
+ root: async (file) => {
|
|
|
+ // 1) Nearest Gradle root (multi-project or included build)
|
|
|
+ const settingsRoot = await NearestRoot(["settings.gradle.kts", "settings.gradle"])(file)
|
|
|
+ if (settingsRoot) return settingsRoot
|
|
|
+ // 2) Gradle wrapper (strong root signal)
|
|
|
+ const wrapperRoot = await NearestRoot(["gradlew", "gradlew.bat"])(file)
|
|
|
+ if (wrapperRoot) return wrapperRoot
|
|
|
+ // 3) Single-project or module-level build
|
|
|
+ const buildRoot = await NearestRoot(["build.gradle.kts", "build.gradle"])(file)
|
|
|
+ if (buildRoot) return buildRoot
|
|
|
+ // 4) Maven fallback
|
|
|
+ return NearestRoot(["pom.xml"])(file)
|
|
|
+ },
|
|
|
async spawn(root) {
|
|
|
const distPath = path.join(Global.Path.bin, "kotlin-ls")
|
|
|
const launcherScript =
|