fix: non-scrollable ZLS settings
This commit is contained in:
parent
8a7ca04168
commit
91747319aa
5 changed files with 33 additions and 10 deletions
|
@ -17,6 +17,11 @@ Changelog structure reference:
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Project
|
||||
- ZLS settings not scrollable in the language server list
|
||||
|
||||
## [25.0.1]
|
||||
|
||||
### Fixed
|
||||
|
|
|
@ -25,6 +25,7 @@ package com.falsepattern.zigbrains.project.toolchain.base
|
|||
import com.falsepattern.zigbrains.project.settings.ZigProjectConfigurationProvider
|
||||
import com.falsepattern.zigbrains.project.toolchain.ui.ImmutableElementPanel
|
||||
import com.falsepattern.zigbrains.project.toolchain.zigToolchainList
|
||||
import com.falsepattern.zigbrains.shared.ui.UUIDComboBoxDriver.Companion.wrapModal
|
||||
import com.intellij.openapi.ui.NamedConfigurable
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
|
@ -37,7 +38,7 @@ abstract class ZigToolchainConfigurable<T: ZigToolchain>(
|
|||
val uuid: UUID,
|
||||
tc: T,
|
||||
val data: ZigProjectConfigurationProvider.IUserDataBridge?,
|
||||
val modal: Boolean
|
||||
private val modal: Boolean
|
||||
): NamedConfigurable<UUID>() {
|
||||
var toolchain: T = tc
|
||||
set(value) {
|
||||
|
@ -64,7 +65,7 @@ abstract class ZigToolchainConfigurable<T: ZigToolchain>(
|
|||
views.forEach { it.attach(this@panel) }
|
||||
}.withMinimumWidth(20)
|
||||
views.forEach { it.reset(toolchain) }
|
||||
return p
|
||||
return wrapModal(p, modal)
|
||||
}
|
||||
|
||||
override fun getEditableObject(): UUID? {
|
||||
|
|
|
@ -24,8 +24,11 @@ package com.falsepattern.zigbrains.shared.ui
|
|||
|
||||
import com.falsepattern.zigbrains.shared.UUIDMapSerializable
|
||||
import com.intellij.openapi.ui.NamedConfigurable
|
||||
import com.intellij.ui.components.JBScrollPane
|
||||
import java.awt.Component
|
||||
import java.awt.Dimension
|
||||
import java.util.*
|
||||
import javax.swing.JComponent
|
||||
|
||||
interface UUIDComboBoxDriver<T> {
|
||||
val theMap: UUIDMapSerializable.Converting<T, *, *>
|
||||
|
@ -34,4 +37,15 @@ interface UUIDComboBoxDriver<T> {
|
|||
fun createComboBox(model: ZBModel<T>): ZBComboBox<T>
|
||||
suspend fun resolvePseudo(context: Component, elem: ListElem.Pseudo<T>): UUID?
|
||||
fun createNamedConfigurable(uuid: UUID, elem: T): NamedConfigurable<UUID>
|
||||
|
||||
companion object {
|
||||
fun wrapModal(component: JComponent, modal: Boolean): JComponent {
|
||||
if (modal) {
|
||||
component.preferredSize = Dimension(640, 480)
|
||||
return component
|
||||
} else {
|
||||
return JBScrollPane(component)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -22,14 +22,14 @@
|
|||
|
||||
package com.falsepattern.zigbrains.lsp.zls
|
||||
|
||||
import com.falsepattern.zigbrains.shared.ui.UUIDComboBoxDriver.Companion.wrapModal
|
||||
import com.intellij.openapi.ui.NamedConfigurable
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import java.awt.Dimension
|
||||
import java.util.*
|
||||
import javax.swing.JComponent
|
||||
|
||||
class ZLSConfigurable(val uuid: UUID, zls: ZLSVersion): NamedConfigurable<UUID>() {
|
||||
class ZLSConfigurable(val uuid: UUID, zls: ZLSVersion, private val modal: Boolean): NamedConfigurable<UUID>() {
|
||||
var zls: ZLSVersion = zls
|
||||
set(value) {
|
||||
zlsInstallations[uuid] = value
|
||||
|
@ -59,8 +59,7 @@ class ZLSConfigurable(val uuid: UUID, zls: ZLSVersion): NamedConfigurable<UUID>(
|
|||
val p = panel {
|
||||
view.attach(this@panel)
|
||||
}
|
||||
p.preferredSize = Dimension(640, 480)
|
||||
return p
|
||||
return wrapModal(p, modal)
|
||||
}
|
||||
|
||||
override fun getDisplayName(): @NlsContexts.ConfigurableName String? {
|
||||
|
|
|
@ -67,10 +67,6 @@ sealed interface ZLSDriver: UUIDComboBoxDriver<ZLSVersion> {
|
|||
return ZLSComboBox(model)
|
||||
}
|
||||
|
||||
override fun createNamedConfigurable(uuid: UUID, elem: ZLSVersion): NamedConfigurable<UUID> {
|
||||
return ZLSConfigurable(uuid, elem)
|
||||
}
|
||||
|
||||
override suspend fun resolvePseudo(
|
||||
context: Component,
|
||||
elem: ListElem.Pseudo<ZLSVersion>
|
||||
|
@ -93,6 +89,10 @@ sealed interface ZLSDriver: UUIDComboBoxDriver<ZLSVersion> {
|
|||
return res
|
||||
}
|
||||
|
||||
override fun createNamedConfigurable(uuid: UUID, elem: ZLSVersion): NamedConfigurable<UUID> {
|
||||
return ZLSConfigurable(uuid, elem, false)
|
||||
}
|
||||
|
||||
override val data: ZigProjectConfigurationProvider.IUserDataBridge?
|
||||
get() = null
|
||||
}
|
||||
|
@ -113,6 +113,10 @@ sealed interface ZLSDriver: UUIDComboBoxDriver<ZLSVersion> {
|
|||
res.add(suggestZLSVersions(project, data, toolchainVersion).asPending())
|
||||
return res
|
||||
}
|
||||
|
||||
override fun createNamedConfigurable(uuid: UUID, elem: ZLSVersion): NamedConfigurable<UUID> {
|
||||
return ZLSConfigurable(uuid, elem, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue