improved completion
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package dev.hgh.jai.settings
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.PathMacroManager
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.components.State
|
||||
import com.intellij.openapi.components.Storage
|
||||
@@ -62,7 +63,7 @@ class JaiProjectSettings(
|
||||
val trimmed = rawPath.trim()
|
||||
if (trimmed.isEmpty()) return null
|
||||
|
||||
val expanded =
|
||||
var expanded =
|
||||
when {
|
||||
trimmed == "~" -> {
|
||||
System.getProperty("user.home")
|
||||
@@ -76,6 +77,20 @@ class JaiProjectSettings(
|
||||
trimmed
|
||||
}
|
||||
}
|
||||
// Workspace files may persist project-relative roots using IntelliJ path macros. The
|
||||
// settings UI normally supplies absolute paths, but loading a project saved elsewhere
|
||||
// must expand these before the resolver tries to find the VFS root.
|
||||
expanded = PathMacroManager.getInstance(project).expandPath(expanded)
|
||||
expanded =
|
||||
expanded
|
||||
.replace("\$USER_HOME\$", System.getProperty("user.home"))
|
||||
.replace("\$USER_HOME", System.getProperty("user.home"))
|
||||
.let { value ->
|
||||
val basePath = project.basePath ?: return@let value
|
||||
value
|
||||
.replace("\$PROJECT_DIR\$", basePath)
|
||||
.replace("\$PROJECT_DIR", basePath)
|
||||
}
|
||||
val file = File(expanded)
|
||||
val absolute =
|
||||
if (file.isAbsolute) {
|
||||
|
||||
Reference in New Issue
Block a user