-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Features] - Preview for simple constant fields is now renders also in code completion popup [Bug Fixes] - Unspecified color is now excluded from rendering - Switched to using the kotlin IDE's built-in stdlib instead of the explicit one
- Loading branch information
Showing
60 changed files
with
375 additions
and
131 deletions.
There are no files selected for viewing
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Publish Plugin" type="GradleRunConfiguration" factoryName="Gradle"> | ||
<ExternalSystemSettings> | ||
<option name="executionName" /> | ||
<option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||
<option name="externalSystemIdString" value="GRADLE" /> | ||
<option name="scriptParameters" value="--no-build-cache --no-configuration-cache" /> | ||
<option name="taskDescriptions"> | ||
<list /> | ||
</option> | ||
<option name="taskNames"> | ||
<list> | ||
<option value="clean" /> | ||
<option value=":compose-color-preview-plugin:publishPlugin" /> | ||
</list> | ||
</option> | ||
<option name="vmOptions" /> | ||
</ExternalSystemSettings> | ||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
<EXTENSION ID="com.intellij.execution.ExternalSystemRunConfigurationJavaExtension"> | ||
<extension name="net.ashald.envfile"> | ||
<option name="IS_ENABLED" value="false" /> | ||
<option name="IS_SUBST" value="false" /> | ||
<option name="IS_PATH_MACRO_SUPPORTED" value="false" /> | ||
<option name="IS_IGNORE_MISSING_FILES" value="false" /> | ||
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> | ||
<ENTRIES> | ||
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> | ||
</ENTRIES> | ||
</extension> | ||
</EXTENSION> | ||
<DebugAllEnabled>false</DebugAllEnabled> | ||
<RunAsTest>false</RunAsTest> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<component name="ProjectRunConfigurationManager"> | ||
<configuration default="false" name="Run Plugin" type="GradleRunConfiguration" factoryName="Gradle"> | ||
<log_file alias="idea.log" path="$PROJECT_DIR$/build/idea-sandbox/system/log/idea.log" /> | ||
<ExternalSystemSettings> | ||
<option name="executionName" /> | ||
<option name="externalProjectPath" value="$PROJECT_DIR$" /> | ||
<option name="externalSystemIdString" value="GRADLE" /> | ||
<option name="scriptParameters" value="" /> | ||
<option name="taskDescriptions"> | ||
<list /> | ||
</option> | ||
<option name="taskNames"> | ||
<list> | ||
<option value=":compose-color-preview-plugin:runIde" /> | ||
</list> | ||
</option> | ||
<option name="vmOptions" value="" /> | ||
</ExternalSystemSettings> | ||
<ExternalSystemDebugServerProcess>true</ExternalSystemDebugServerProcess> | ||
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess> | ||
<EXTENSION ID="com.intellij.execution.ExternalSystemRunConfigurationJavaExtension"> | ||
<extension name="net.ashald.envfile"> | ||
<option name="IS_ENABLED" value="false" /> | ||
<option name="IS_SUBST" value="false" /> | ||
<option name="IS_PATH_MACRO_SUPPORTED" value="false" /> | ||
<option name="IS_IGNORE_MISSING_FILES" value="false" /> | ||
<option name="IS_ENABLE_EXPERIMENTAL_INTEGRATIONS" value="false" /> | ||
<ENTRIES> | ||
<ENTRY IS_ENABLED="true" PARSER="runconfig" IS_EXECUTABLE="false" /> | ||
</ENTRIES> | ||
</extension> | ||
</EXTENSION> | ||
<DebugAllEnabled>false</DebugAllEnabled> | ||
<RunAsTest>false</RunAsTest> | ||
<method v="2" /> | ||
</configuration> | ||
</component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,6 @@ | ||
fun prop(key: String) = project.findProperty(key).toString() | ||
|
||
plugins { | ||
id("java") | ||
id("org.jetbrains.intellij") version "1.17.3" | ||
// https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library | ||
id("org.jetbrains.kotlin.jvm") version "1.7.0" | ||
} | ||
|
||
val ideMinVersion = "223" | ||
val pluginMajorVersion = "0.0.7" | ||
|
||
group = "ru.ztrap.plugin.idea" | ||
version = "$pluginMajorVersion-$ideMinVersion" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html | ||
intellij { | ||
version = "2022.3" | ||
type = "IC" | ||
|
||
plugins = listOf( | ||
"com.intellij.java", | ||
"org.jetbrains.kotlin", | ||
) | ||
} | ||
|
||
val jvmVersion = JavaVersion.VERSION_17.toString() | ||
|
||
tasks { | ||
buildSearchableOptions { | ||
enabled = false | ||
} | ||
|
||
// Set the JVM compatibility versions | ||
compileJava { | ||
sourceCompatibility = jvmVersion | ||
targetCompatibility = jvmVersion | ||
} | ||
|
||
compileKotlin { | ||
kotlinOptions.jvmTarget = jvmVersion | ||
} | ||
|
||
patchPluginXml { | ||
version = project.version.toString() | ||
sinceBuild = ideMinVersion | ||
untilBuild = "223.*" | ||
} | ||
|
||
signPlugin { | ||
certificateChainFile = file(prop("publishing.plugin.key.chain")) | ||
privateKeyFile = file(prop("publishing.plugin.key")) | ||
password = prop("publishing.plugin.password") | ||
} | ||
|
||
publishPlugin { | ||
token = prop("publishing.plugin.token") | ||
} | ||
} | ||
alias(deps.plugins.intellij) apply false | ||
alias(deps.plugins.kotlin.forPlugin) apply false | ||
alias(deps.plugins.compose) apply false | ||
alias(deps.plugins.kotlin.forSample) apply false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib | ||
kotlin.stdlib.default.dependency=false | ||
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html | ||
org.gradle.configuration-cache=true | ||
# Enable Gradle Build Cache -> https://docs.gradle.org/current/userguide/build_cache.html | ||
org.gradle.caching=true | ||
org.gradle.configuration-cache=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[versions] | ||
# https://plugins.jetbrains.com/docs/intellij/using-kotlin.html#kotlin-standard-library | ||
kotlin-forPlugin = "1.7.0" | ||
kotlin-forSample = "1.9.23" | ||
intellij = "1.17.3" | ||
compose = "1.6.2" | ||
|
||
plugin = "0.0.8" | ||
idea-name = "2022.3" | ||
idea-code-min = "223" | ||
idea-code-max = "223" | ||
jvm = "17" | ||
|
||
[plugins] | ||
kotlin-forPlugin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-forPlugin" } | ||
kotlin-forSample = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-forSample" } | ||
intellij = { id = "org.jetbrains.intellij", version.ref = "intellij" } | ||
compose = { id = "org.jetbrains.compose", version.ref = "compose" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
plugins { | ||
java | ||
alias(deps.plugins.intellij) | ||
alias(deps.plugins.kotlin.forPlugin) | ||
} | ||
|
||
group = "ru.ztrap.plugin.idea" | ||
version = "${deps.versions.plugin.get()}-${deps.versions.idea.code.min.get()}" | ||
|
||
// See https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html | ||
intellij { | ||
version = deps.versions.idea.name | ||
type = "IC" | ||
|
||
plugins = listOf( | ||
"com.intellij.java", | ||
"org.jetbrains.kotlin", | ||
) | ||
} | ||
|
||
val jvmVersion = deps.versions.jvm.get() | ||
|
||
tasks { | ||
buildSearchableOptions { | ||
enabled = false | ||
} | ||
|
||
// Set the JVM compatibility versions | ||
compileJava { | ||
sourceCompatibility = jvmVersion | ||
targetCompatibility = jvmVersion | ||
} | ||
|
||
compileKotlin { | ||
kotlinOptions.jvmTarget = jvmVersion | ||
} | ||
|
||
patchPluginXml { | ||
version = project.version.toString() | ||
sinceBuild = deps.versions.idea.code.min | ||
untilBuild = "${deps.versions.idea.code.max.get()}.*" | ||
} | ||
|
||
signPlugin { | ||
certificateChainFile = file(prop("publishing.plugin.key.chain")) | ||
privateKeyFile = file(prop("publishing.plugin.key")) | ||
password = prop("publishing.plugin.password") | ||
} | ||
|
||
publishPlugin { | ||
token = prop("publishing.plugin.token") | ||
} | ||
} | ||
|
||
fun prop(key: String) = project.findProperty(key).toString() | ||
|
||
repositories { | ||
mavenCentral() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
47 changes: 47 additions & 0 deletions
47
...in/idea/compose/color/preview/codeInsight/completion/ComposeColorCompletionContributor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package ru.ztrap.plugin.idea.compose.color.preview.codeInsight.completion | ||
|
||
import com.intellij.codeInsight.completion.CompletionContributor | ||
import com.intellij.codeInsight.completion.CompletionParameters | ||
import com.intellij.codeInsight.completion.CompletionResultSet | ||
import com.intellij.codeInsight.lookup.LookupElement | ||
import com.intellij.codeInsight.lookup.LookupElementDecorator | ||
import com.intellij.codeInsight.lookup.LookupElementPresentation | ||
import com.intellij.util.ui.ColorIcon | ||
import javax.swing.Icon | ||
import org.jetbrains.kotlin.psi.KtProperty | ||
import ru.ztrap.plugin.idea.compose.color.preview.utils.getColorOrNull | ||
import ru.ztrap.plugin.idea.compose.color.preview.utils.resolveKtProperty | ||
import ru.ztrap.plugin.idea.compose.color.preview.utils.safeCast | ||
import ru.ztrap.plugin.idea.compose.color.preview.utils.toAwtColor | ||
|
||
class ComposeColorCompletionContributor : CompletionContributor() { | ||
|
||
override fun fillCompletionVariants(parameters: CompletionParameters, result: CompletionResultSet) { | ||
result.runRemainingContributors(parameters) { completionResult -> | ||
val lookupElement = completionResult.lookupElement | ||
|
||
val newResult = lookupElement.psiElement | ||
?.navigationElement | ||
?.safeCast<KtProperty>() | ||
?.let(::resolveKtProperty) | ||
?.getColorOrNull() | ||
?.toAwtColor() | ||
?.let { ColorIcon(16, 12, it, true) } | ||
?.let { ComposeColorLookupElementDecorator(lookupElement, it) } | ||
?.let(completionResult::withLookupElement) | ||
?: completionResult | ||
|
||
result.passResult(newResult) | ||
} | ||
} | ||
|
||
private class ComposeColorLookupElementDecorator( | ||
delegate: LookupElement, | ||
private val icon: Icon, | ||
) : LookupElementDecorator<LookupElement>(delegate) { | ||
override fun renderElement(presentation: LookupElementPresentation) { | ||
super.renderElement(presentation) | ||
presentation.icon = icon | ||
} | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...rker/provider/ColorAwareLineMarkerInfo.kt → ...nsight/daemon/ColorAwareLineMarkerInfo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.