From 24061d00693e6a49240ebf83af5bf9bc760100b2 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Sun, 24 Dec 2023 19:05:39 +0100 Subject: [PATCH] change plugin id, update readme --- CHANGELOG.md | 4 ++++ README.md | 12 ++++++------ gradle.properties | 4 ++-- .../jetbrains/plugins/d2}/editor/D2ColorProvider.kt | 9 ++++----- src/main/resources/META-INF/plugin.xml | 6 +++--- 5 files changed, 19 insertions(+), 16 deletions(-) rename src/main/kotlin/{com/dvd/intellij/d2/ide => org/jetbrains/plugins/d2}/editor/D2ColorProvider.kt (88%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 111706f..908b0a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ## [Unreleased] +## [0.0.3-eap] - 2023-12-24 +- Highlighting works for most D2 syntax. +- Fix element color provider (`logs.style.stroke: "#f4a261"`) + ## [0.0.2-eap] - 2022-12-13 ### Added diff --git a/README.md b/README.md index 55f0bdd..780ff60 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,21 @@ # d2-intellij -![Build](https://github.com/DVDAndroid/d2-intellij/workflows/Build/badge.svg) +![Build](https://github.com/develar/d2-intellij-plugin/workflows/Build/badge.svg) [![Version](https://img.shields.io/jetbrains/plugin/v/20630.svg)](https://plugins.jetbrains.com/plugin/20630) [![Downloads](https://img.shields.io/jetbrains/plugin/d/20630.svg)](https://plugins.jetbrains.com/plugin/20630) -Basic language support for D2 for JetBrains IDEs. +Language support for D2 for JetBrains IDEs. ## Installation -- Using IDE built-in plugin system: - +- Using an IDE built-in plugin system: + Settings/Preferences > Plugins > Marketplace > Search for "d2-intellij" > Install Plugin - + - Manually: - Download the [latest release](https://github.com/DVDAndroid/d2-intellij/releases/latest) and install it manually using + Download the [latest release](https://github.com/develar/d2-intellij-plugin/releases/latest) and install it manually using Settings/Preferences > Plugins > ⚙️ > Install plugin from disk... \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index a5d3e4c..1257d94 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,9 +1,9 @@ pluginGroup=com.dvd.intellij.d2 pluginName=d2-intellij -pluginRepositoryUrl=https://github.com/DVDAndroid/d2-intellij +pluginRepositoryUrl=https://github.com/develar/d2-intellij-plugin pluginVersion=0.0.3-eap -pluginSinceBuild=223 +pluginSinceBuild=232 pluginUntilBuild=241.* platformType=IC diff --git a/src/main/kotlin/com/dvd/intellij/d2/ide/editor/D2ColorProvider.kt b/src/main/kotlin/org/jetbrains/plugins/d2/editor/D2ColorProvider.kt similarity index 88% rename from src/main/kotlin/com/dvd/intellij/d2/ide/editor/D2ColorProvider.kt rename to src/main/kotlin/org/jetbrains/plugins/d2/editor/D2ColorProvider.kt index 875ac34..0203b36 100644 --- a/src/main/kotlin/com/dvd/intellij/d2/ide/editor/D2ColorProvider.kt +++ b/src/main/kotlin/org/jetbrains/plugins/d2/editor/D2ColorProvider.kt @@ -1,4 +1,4 @@ -package com.dvd.intellij.d2.ide.editor +package org.jetbrains.plugins.d2.editor import com.dvd.intellij.d2.ide.utils.ColorStyleValidator import com.intellij.openapi.editor.ElementColorProvider @@ -10,10 +10,9 @@ import org.jetbrains.plugins.d2.lang.D2ElementTypes import org.jetbrains.plugins.d2.lang.D2Language import java.awt.Color -class D2ColorProvider : ElementColorProvider { - private val Color.hex: String - get() = String.format("#%02x%02x%02x", red, green, blue) +private fun getHex(color: Color): String = String.format("#%02x%02x%02x", color.red, color.green, color.blue) +class D2ColorProvider : ElementColorProvider { override fun getColorFrom(element: PsiElement): Color? { if (element.elementType !in listOf(D2ElementTypes.ID, D2ElementTypes.STRING)) { return null @@ -35,7 +34,7 @@ class D2ColorProvider : ElementColorProvider { val psiManager = PsiManager.getInstance(element.project) val factory = PsiFileFactoryImpl(psiManager) val newPsi = factory.createElementFromText( - "\"${color.hex}\"", + "\"${getHex(color)}\"", D2Language, D2ElementTypes.PROPERTY_VALUE, element.context diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index fd7354d..1fba8c7 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ - com.dvd.intellij.d2 + org.jetbrains.plugins.d2 D2 - dvdandroid + Vladimir Krivosheev --replaced by plugin-- com.intellij.modules.platform @@ -24,7 +24,7 @@ - +