From 91a36c370d17e38d54b3dc6df76dd34767ce0dfe Mon Sep 17 00:00:00 2001 From: Oleg Kizeev Date: Fri, 24 May 2024 21:58:46 +0700 Subject: [PATCH] Syntax highlighting support in IDEA Community Edition --- CHANGELOG.md | 6 ++++ README.md | 2 +- build.gradle.kts | 27 +++++++-------- gradle.properties | 6 ++-- ...nguageClient.kt => SlintLanguageClient.kt} | 4 ++- .../ide/lsp/SlintLspServerDescriptor.kt | 3 +- src/main/resources/META-INF/plugin.xml | 33 +------------------ .../META-INF/slint-idea-lsp-support.xml | 33 +++++++++++++++++++ 8 files changed, 63 insertions(+), 51 deletions(-) rename src/main/kotlin/dev/slint/ideaplugin/ide/lsp/{LspLanguageClient.kt => SlintLanguageClient.kt} (69%) create mode 100644 src/main/resources/META-INF/slint-idea-lsp-support.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 77237ab..e00312d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ ## [Unreleased] +### Features + +- Support for IDEA 2024 +- Syntax highlighting support in IDEA Community Edition and Android Studio (2024 and above) +- Slint-LSP binary v1.6.0 + ## [1.0.2] - 2024-03-23 ### Fixed diff --git a/README.md b/README.md index 7988102..232d4ad 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ ## Description -[Slint](https://slint.dev) support for IDEs based on IntelliJ Platform. **Plugin is unofficial!** +[Slint](https://slint.dev) support for IDEs based on IntelliJ Platform (simplified functionality for IDEA Community Edition). **Plugin is unofficial!** The following features are supported: - Syntax highlighting diff --git a/build.gradle.kts b/build.gradle.kts index 1c92f04..89e8bbf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -136,21 +136,22 @@ tasks { channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) } } -// task("downloadSlintLspVscodePlugin", type = Download::class) { -// src("https://Slint.gallery.vsassets.io/_apis/public/gallery/publisher/Slint/extension/slint/${slintLspVersion}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage") -// dest("${project.buildDir}/tmp/slint-${slintLspVersion}-vscode-plugin.zip") -// onlyIfModified(true) -// } -// -// task("extractSlintLspVscodePlugin", type = Copy::class) { -// dependsOn("downloadSlintLspVscodePlugin") -// from(zipTree("${project.buildDir}/tmp/slint-${slintLspVersion}-vscode-plugin.zip")) { -// destinationDir = file("${project.buildDir}/tmp/slint-vscode-plugin") -// } -// } + task("downloadSlintLspVscodePlugin", type = Download::class) { + src("https://Slint.gallery.vsassets.io/_apis/public/gallery/publisher/Slint/extension/slint/${slintLspVersion}/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage") + dest("${project.buildDir}/tmp/slint-${slintLspVersion}-vscode-plugin.zip") + onlyIfModified(true) + overwrite(false) + } + + task("extractSlintLspVscodePlugin", type = Copy::class) { + dependsOn("downloadSlintLspVscodePlugin") + from(zipTree("${project.buildDir}/tmp/slint-${slintLspVersion}-vscode-plugin.zip")) { + destinationDir = file("${project.buildDir}/tmp/slint-vscode-plugin") + } + } prepareSandbox { - // dependsOn("extractSlintLspVscodePlugin") + dependsOn("extractSlintLspVscodePlugin") from("${project.buildDir}/tmp/slint-vscode-plugin/extension/bin") { into("${intellij.pluginName.get()}/language-server/bin") } diff --git a/gradle.properties b/gradle.properties index 70716d5..8fa2c61 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,11 +11,11 @@ pluginGroup = dev.slint pluginName = SlintPlugin pluginVersion = 1.0.2 platformType = IU -# platformType = CL -platformVersion = 241-EAP-SNAPSHOT +#platformVersion = 242-EAP-SNAPSHOT +platformVersion = 2024.1 pluginSinceBuild = 241 pluginUntilBuild = platformPlugins = jvmVersion = 17 -slintLspVersion = 1.5.1 +slintLspVersion = 1.6.0 diff --git a/src/main/kotlin/dev/slint/ideaplugin/ide/lsp/LspLanguageClient.kt b/src/main/kotlin/dev/slint/ideaplugin/ide/lsp/SlintLanguageClient.kt similarity index 69% rename from src/main/kotlin/dev/slint/ideaplugin/ide/lsp/LspLanguageClient.kt rename to src/main/kotlin/dev/slint/ideaplugin/ide/lsp/SlintLanguageClient.kt index eab7bb6..bc1813f 100644 --- a/src/main/kotlin/dev/slint/ideaplugin/ide/lsp/LspLanguageClient.kt +++ b/src/main/kotlin/dev/slint/ideaplugin/ide/lsp/SlintLanguageClient.kt @@ -4,7 +4,9 @@ import com.intellij.platform.lsp.api.Lsp4jClient import com.intellij.platform.lsp.api.LspServerNotificationsHandler import org.eclipse.lsp4j.jsonrpc.services.JsonNotification -class LspLanguageClient(handler: LspServerNotificationsHandler) : Lsp4jClient(handler) { +class SlintLanguageClient( + serverNotificationsHandler: LspServerNotificationsHandler +) : Lsp4jClient(serverNotificationsHandler) { @JsonNotification("experimental/serverStatus") fun serverStatus(status: Any?) { } diff --git a/src/main/kotlin/dev/slint/ideaplugin/ide/lsp/SlintLspServerDescriptor.kt b/src/main/kotlin/dev/slint/ideaplugin/ide/lsp/SlintLspServerDescriptor.kt index 2b0574f..82bbb4d 100644 --- a/src/main/kotlin/dev/slint/ideaplugin/ide/lsp/SlintLspServerDescriptor.kt +++ b/src/main/kotlin/dev/slint/ideaplugin/ide/lsp/SlintLspServerDescriptor.kt @@ -22,7 +22,8 @@ class SlintLspServerDescriptor(project: Project) : ProjectWideLspServerDescripto override fun createInitializationOptions(): Any = SlintSettingsState.getInstance().lspSettings - override fun createLsp4jClient(handler: LspServerNotificationsHandler): Lsp4jClient = LspLanguageClient(handler) + // Suppression of the verifier plugin warning + // override fun createLsp4jClient(handler: LspServerNotificationsHandler): Lsp4jClient = LspLanguageClient(handler) override fun startServerProcess(): OSProcessHandler = ServerProcessHandler.addListeners(super.startServerProcess(), project) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index d50432f..d343491 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -11,8 +11,7 @@ kizeev messages.SlintBundle - com.intellij.modules.platform - com.intellij.modules.ultimate + com.intellij.modules.ultimate @@ -29,7 +28,6 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/META-INF/slint-idea-lsp-support.xml b/src/main/resources/META-INF/slint-idea-lsp-support.xml new file mode 100644 index 0000000..230c6a3 --- /dev/null +++ b/src/main/resources/META-INF/slint-idea-lsp-support.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file