Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 243 compilation #103

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ version = providers.gradleProperty("pluginVersion").get()

// Set the JVM language level used to build the project.
kotlin {
jvmToolchain(17)
jvmToolchain(21)
}

// Configure project's dependencies
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pluginUntilBuild = 243.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = WS
platformVersion = 2024.1.1
platformVersion = 2024.3

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
junit = "4.13.2"

# plugins
intelliJPlatform = "2.0.1"
intelliJPlatform = "2.1.0"
kotlin = "1.9.25"

[libraries]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ class BiomeLspServerSupportProvider : LspServerSupportProvider {
)
}

@Suppress("UnstableApiUsage")
class BiomeLspServerManagerListener(val project: Project) : LspServerManagerListener {
override fun serverStateChanged(lspServer: LspServer) {
if (lspServer.descriptor is BiomeLspServerDescriptor && lspServer.state == LspServerState.ShutdownUnexpectedly) {
// restart again if the server was shutdown unexpectedly.
// This can be caused by race condition, when we restart LSP server because of config change,
// but Intellij also tried to send a request to it at the same time.
// Unfortunate There is no way prevent IDEA send requests after LSP started.
project.service<BiomeServerService>().restartBiomeServer()
}
}
}

@Suppress("UnstableApiUsage")
private class BiomeLspServerDescriptor(project: Project, val executable: String, val configPath: String?) :
ProjectWideLspServerDescriptor(project, "Biome") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ package com.github.biomejs.intellijbiome.services

import com.github.biomejs.intellijbiome.BiomeBundle
import com.github.biomejs.intellijbiome.listeners.BiomeEditorPanelListener
import com.github.biomejs.intellijbiome.lsp.BiomeLspServerManagerListener
import com.github.biomejs.intellijbiome.lsp.BiomeLspServerSupportProvider
import com.intellij.notification.NotificationGroupManager
import com.intellij.notification.NotificationType
import com.intellij.openapi.components.Service
import com.intellij.openapi.fileEditor.FileEditorManagerListener
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import com.intellij.platform.lsp.api.LspServerManager

@Service(Service.Level.PROJECT)
class BiomeServerService(private val project: Project) {
private val editorPanelListener: BiomeEditorPanelListener

init {
addBiomeLspListener()
editorPanelListener = BiomeEditorPanelListener(project)
project.messageBus.connect().subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, editorPanelListener)
}
Expand All @@ -30,11 +27,6 @@ class BiomeServerService(private val project: Project) {
LspServerManager.getInstance(project).stopAndRestartIfNeeded(BiomeLspServerSupportProvider::class.java)
}

fun addBiomeLspListener() {
LspServerManager.getInstance(project)
.addLspServerManagerListener(BiomeLspServerManagerListener(project), Disposer.newDisposable(), true)
}

fun stopBiomeServer() {
LspServerManager.getInstance(project).stopServers(BiomeLspServerSupportProvider::class.java)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ class BiomeConfigurable(internal val project: Project) :

row(BiomeBundle.message("biome.config.path.label")) {
textFieldWithBrowseButton(
BiomeBundle.message("biome.config.path.label"),
project,
FileChooserDescriptorFactory.createSingleFileOrFolderDescriptor()
.withTitle(BiomeBundle.message("biome.config.path.label")),
project,
) { fileChosen(it) }
.bindText(settings::configPath)
.validationOnInput(validateConfigDir())
Expand Down
Loading