Skip to content

Commit

Permalink
Workflow configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
kizeevov committed Nov 16, 2023
1 parent 6f6e13a commit 70336e3
Show file tree
Hide file tree
Showing 7 changed files with 140 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!-- Keep a Changelog guide -> https://keepachangelog.com -->

# Slint-Idea-Plugin Changelog

## [Unreleased]

## [0.2.7] - 2023-11-15

### Fixed
- export error;
- repetition error;
- conditional element error;
- model declaration error;

## [0.2.6] - 2023-11-13

### Fixed
- color error for hex colors with alpha channel;
- state declaration error;
- export error;
- error declaring global singletons;
- property binding error;
- element declaration error;
- error declaring an animation block;
- image declaration error;
- gradient declaration error;

### Added
- added highlighting of numeric values with units;
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# Slint plugin for the IntelliJ Platform

[![Build](https://github.com/kizeevov/slint-idea-plugin/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/kizeevov/slint-idea-plugin/actions/workflows/build.yml)
[![Version](https://img.shields.io/jetbrains/plugin/v/23065.svg)](https://plugins.jetbrains.com/plugin/23065)
[![Downloads](https://img.shields.io/jetbrains/plugin/d/23065.svg)](https://plugins.jetbrains.com/plugin/23065)

## Description

<!-- Plugin description -->
[Slint](https://slint.dev) support for IDEs based on IntelliJ Platform. **Plugin is experimental and unofficial!**

The following features are supported:
- Syntax highlighting
- Slint-LSP support
- Preview support
<!-- Plugin description end -->

Tested with:
- CLion 2023.2
- IDEA Ultimate 2023.2
Expand All @@ -16,27 +27,18 @@ Slint IntelliJ Plugin communicates with Slint-LSP. Install before you can use th
$ cargo install slint-lsp
```

> need version 1.2.2 and above
## Installation

- Using IDE built-in plugin system:
Using IDE built-in plugin system:

<kbd>Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>Marketplace</kbd> > <kbd>Search for "slint"</kbd> >
<kbd>Install Plugin</kbd>

- Manually:
Manually:

Download the [latest release](https://github.com/kizeevov/slint-idea-plugin/releases) and install it manually using
<kbd>Preferences</kbd> > <kbd>Plugins</kbd> > <kbd>⚙️</kbd> > <kbd>Install plugin from disk...</kbd>

## Configuration

Go to <kbd>Settings</kbd> > <kbd>Languages & Frameworks</kbd> > <kbd>Slint</kbd> > <kbd>Slint-lsp path</kbd> selected path

## Features

- [x] highlighting
- [x] slint-lsp support
- [x] preview support
- [x] plugin configuration
92 changes: 66 additions & 26 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.intellij.tasks.PatchPluginXmlTask
import org.jetbrains.changelog.Changelog
import org.jetbrains.changelog.markdownToHTML

fun properties(key: String) = project.findProperty(key).toString()
fun properties(key: String) = providers.gradleProperty(key)
fun environment(key: String) = providers.environmentVariable(key)

plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.9.0"
id("org.jetbrains.intellij") version "1.16.0"
id("org.jetbrains.grammarkit") version "2022.3.1"
alias(libs.plugins.kotlin)
alias(libs.plugins.intellij)
alias(libs.plugins.grammarkit)
alias(libs.plugins.changelog)
}

group = properties("pluginGroup")
version = properties("pluginVersion")
group = properties("pluginGroup").get()
version = properties("pluginVersion").get()

idea {
module {
Expand Down Expand Up @@ -44,25 +48,30 @@ repositories {
// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
pluginName.set(properties("pluginName"))
version.set(properties("platformVersion"))
type.set(properties("platformType"))
plugins.set(properties("platformPlugins").split(',').map(String::trim).filter(String::isNotEmpty))
pluginName = properties("pluginName")
version = properties("platformVersion")
type = properties("platformType")
plugins = properties("platformPlugins").map { it.split(',').map(String::trim).filter(String::isNotEmpty) }
}

changelog {
groups.empty()
repositoryUrl = properties("pluginRepositoryUrl")
}

tasks {
generateLexer {
sourceFile.set(file("src/main/grammars/SlintLexer.flex"))
targetDir.set("src/gen/dev/slint/ideaplugin/lang/lexer")
targetClass.set("_SlintLexer")
purgeOldFiles.set(true)
sourceFile = file("src/main/grammars/SlintLexer.flex")
targetDir = "src/gen/dev/slint/ideaplugin/lang/lexer"
targetClass = "_SlintLexer"
purgeOldFiles = true
}
generateParser {
sourceFile.set(file("src/main/grammars/SlintParser.bnf"))
targetRoot.set("src/gen")
pathToParser.set("dev/slint/ideaplugin/lang/parser/SlintParser.java")
pathToPsiRoot.set("dev/slint/ideaplugin/lang/psi")
purgeOldFiles.set(true)
sourceFile = file("src/main/grammars/SlintParser.bnf")
targetRoot = "src/gen"
pathToParser = "dev/slint/ideaplugin/lang/parser/SlintParser.java"
pathToPsiRoot = "dev/slint/ideaplugin/lang/psi"
purgeOldFiles = true
// classpath(project(":$grammarKitFakePsiDeps").sourceSets.main.get().runtimeClasspath)
}

Expand All @@ -78,18 +87,49 @@ tasks {
}

withType<PatchPluginXmlTask> {
version.set(properties("pluginVersion"))
sinceBuild.set(properties("pluginSinceBuild"))
untilBuild.set(properties("pluginUntilBuild"))
version = properties("pluginVersion")
sinceBuild = properties("pluginSinceBuild")
untilBuild = properties("pluginUntilBuild")

// Extract the <!-- Plugin description --> section from README.md and provide for the plugin's manifest
pluginDescription = providers.fileContents(layout.projectDirectory.file("README.md")).asText.map {
val start = "<!-- Plugin description -->"
val end = "<!-- Plugin description end -->"

with (it.lines()) {
if (!containsAll(listOf(start, end))) {
throw GradleException("Plugin description section not found in README.md:\n$start ... $end")
}
subList(indexOf(start) + 1, indexOf(end)).joinToString("\n").let(::markdownToHTML)
}
}

val changelog = project.changelog // local variable for configuration cache compatibility
// Get the latest available change notes from the changelog file
changeNotes = properties("pluginVersion").map { pluginVersion ->
with(changelog) {
renderItem(
(getOrNull(pluginVersion) ?: getUnreleased())
.withHeader(false)
.withEmptySections(false),
Changelog.OutputType.HTML,
)
}
}
}

signPlugin {
certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
privateKey.set(System.getenv("PRIVATE_KEY"))
password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
certificateChain = environment("CERTIFICATE_CHAIN")
privateKey = environment("PRIVATE_KEY")
password = environment("PRIVATE_KEY_PASSWORD")
}

publishPlugin {
token.set(System.getenv("PUBLISH_TOKEN"))
dependsOn("patchChangelog")
token = environment("PUBLISH_TOKEN")
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release labels, like 2.1.7-alpha.3
// Specify pre-release label to publish the plugin in a custom Release Channel automatically. Read more:
// https://plugins.jetbrains.com/docs/intellij/deployment.html#specifying-a-release-channel
channels = properties("pluginVersion").map { listOf(it.split('-').getOrElse(1) { "default" }.split('.').first()) }
}
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ org.gradle.configuration-cache = true
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html
org.gradle.caching = true

pluginRepositoryUrl = https://github.com/kizeevov/slint-idea-plugin

pluginGroup = dev.slint
pluginName = SlintPlugin
pluginVersion = 0.2.7
Expand Down
29 changes: 29 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[versions]
# libraries
annotations = "24.0.1"

# plugins
kotlin = "1.9.10"
changelog = "2.2.0"
intellij = "1.16.0"
grammarkit = "2022.3.1"

#gradleIntelliJPlugin = "1.15.0"
#qodana = "0.1.13"
#kover = "0.7.4"

[libraries]
annotations = { group = "org.jetbrains", name = "annotations", version.ref = "annotations" }

[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
intellij = { id = "org.jetbrains.intellij", version.ref = "intellij" }
grammarkit = { id = "org.jetbrains.grammarkit", version.ref = "grammarkit" }


# gradleIntelliJPlugin = { id = "org.jetbrains.intellij", version.ref = "gradleIntelliJPlugin" }

#kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
#kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" }
#qodana = { id = "org.jetbrains.qodana", version.ref = "qodana" }
24 changes: 0 additions & 24 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,6 @@
<vendor email="[email protected]" url="https://github.com/kizeevov/slint-idea-plugin">kizeev</vendor>
<resource-bundle>messages.SlintBundle</resource-bundle>

<!-- Description of the plugin displayed on the Plugin Page and IDE Plugin Manager.
Simple HTML elements (text formatting, paragraphs, and lists) can be added inside of <![CDATA[ ]]> tag.
Guidelines: https://plugins.jetbrains.com/docs/marketplace/plugin-overview-page.html#plugin-description -->
<description><![CDATA[
Support for <a href="https://slint.dev/">Slint</a>. Plugin is experimental and unofficial<br>
Features:<br>
<ul>
<li>highlighting</li>
<li>slint-lsp support</li>
<li>preview support</li>
<li>plugin configuration</li>
</ul>
]]></description>

<change-notes><![CDATA[
Fixed:
<ul>
<li>export error;</li>
<li>repetition error;</li>
<li>conditional element error;</li>
<li>model declaration error;</li>
</ul>
]]></change-notes>

<depends>com.intellij.modules.platform</depends>
<depends>com.intellij.modules.ultimate</depends>

Expand Down

0 comments on commit 70336e3

Please sign in to comment.