Skip to content

Commit

Permalink
Syntax highlighting support in IDEA Community Edition
Browse files Browse the repository at this point in the history
  • Loading branch information
kizeevov committed May 24, 2024
1 parent 81b254f commit 91a36c3
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 51 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
## Description

<!-- Plugin 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
Expand Down
27 changes: 14 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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?) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
33 changes: 1 addition & 32 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
<vendor email="[email protected]" url="https://github.com/kizeevov/slint-idea-plugin">kizeev</vendor>
<resource-bundle>messages.SlintBundle</resource-bundle>

<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.modules.ultimate</depends>
<depends optional="true" config-file="slint-idea-lsp-support.xml">com.intellij.modules.ultimate</depends>

<extensions defaultExtensionNs="com.intellij">
<!-- Language -->
Expand All @@ -29,7 +28,6 @@
<!--Syntax Highlighting-->
<lang.syntaxHighlighter language="Slint"
implementationClass="dev.slint.ideaplugin.ide.highlighting.SlintSyntaxHighlighter"/>
<!-- <colorSettingsPage implementation="dev.slint.ideaplugin.highlighting.SlintColorSettingsPage"/>-->

<!-- Editor -->
<lang.braceMatcher language="Slint"
Expand All @@ -49,43 +47,14 @@
nonDefaultProject="false"
instance="dev.slint.ideaplugin.ide.settings.SlintSettingsConfigurable"/>

<!-- LSP -->
<platform.lsp.serverSupportProvider implementation="dev.slint.ideaplugin.ide.lsp.SlintLspServerSupportProvider"/>

<!-- Line Marker Providers -->
<runLineMarkerContributor language="Slint"
implementationClass="dev.slint.ideaplugin.ide.lineMarkers.PreviewRunLineMarkerContributor"/>

<!-- Formatter -->
<formattingService implementation="dev.slint.ideaplugin.ide.formatter.SlintLspFormattingService"/>

<notificationGroup id="Slint" displayType="BALLOON"/>
<statusBarWidgetFactory implementation="dev.slint.ideaplugin.ide.widgets.SlintStatusBarWidgetFactory"
id="SlintWidget"/>
</extensions>
<actions>
<action id="Slint.NewSlintFile"
class="dev.slint.ideaplugin.ide.actions.SlintCreateFileAction">
<add-to-group group-id="NewGroup" anchor="after" relative-to-action="NewFile"/>
</action>

<group id="SlintGroupedActions">
<separator/>
<add-to-group group-id="ProjectViewPopupMenu"/>

<action id="Slint.Preview"
class="dev.slint.ideaplugin.ide.actions.PreviewAction"
text="Show All Preview"
icon="AllIcons.Actions.Preview"
/>
</group>

<action id="Slint.RestartLspAction"
class="dev.slint.ideaplugin.ide.actions.RestartLspAction"
text="Restart Slint LSP"
description="Restart Slint LSP server"
icon="AllIcons.Actions.Restart">
<add-to-group group-id="ToolsMenu" anchor="last"/>
</action>
</actions>
</idea-plugin>
33 changes: 33 additions & 0 deletions src/main/resources/META-INF/slint-idea-lsp-support.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<!-- LSP -->
<platform.lsp.serverSupportProvider implementation="dev.slint.ideaplugin.ide.lsp.SlintLspServerSupportProvider"/>

<!-- Formatter -->
<formattingService implementation="dev.slint.ideaplugin.ide.formatter.SlintLspFormattingService"/>

<notificationGroup id="Slint" displayType="BALLOON"/>
<statusBarWidgetFactory implementation="dev.slint.ideaplugin.ide.widgets.SlintStatusBarWidgetFactory"
id="SlintWidget"/>
</extensions>
<actions>
<group id="SlintGroupedActions">
<separator/>
<add-to-group group-id="ProjectViewPopupMenu"/>

<action id="Slint.Preview"
class="dev.slint.ideaplugin.ide.actions.PreviewAction"
text="Show All Preview"
icon="AllIcons.Actions.Preview"
/>
</group>

<action id="Slint.RestartLspAction"
class="dev.slint.ideaplugin.ide.actions.RestartLspAction"
text="Restart Slint LSP"
description="Restart Slint LSP server"
icon="AllIcons.Actions.Restart">
<add-to-group group-id="ToolsMenu" anchor="last"/>
</action>
</actions>
</idea-plugin>

0 comments on commit 91a36c3

Please sign in to comment.