Skip to content

Commit a5512d5

Browse files
authored
Feature/add option to disable for long lines (#23)
* Update Gradle and plugin configurations Upgraded Gradle version to 8.14 and updated plugin settings, including Kotlin (2.1.20) and IntelliJ Platform (2.5.0) versions. Removed deprecated properties and cleaned up unused configurations to ensure compatibility with the updated platform version. * Add support for disabling the plugin for large files Introduce `BracketsSettingsState` with options to disable the plugin for files exceeding a configurable line count. Refactor services and annotators to use a `BracketColorizerServiceFactory` for improved modularity and performance. Update plugin metadata and changelog to reflect the changes. * Add settings for bracket pair colorization and large files Introduced a settings section in the README to guide users on configuring bracket pair colorization. Enhanced the settings UI to allow disabling colorization for large files and adjusting the line count threshold. These changes improve customization and usability. * Reverted pluginUntilBuild * Remove redundant code and refine plugin verification logic. Deleted unused `Run Verifications` Gradle run configuration and the `withCustomBrackets` function from `BracketColorizerService`. Enhanced plugin verification to limit IDE versions processed, optimizing for a smaller subset of releases. * Update workflows and enhance plugin verification logging Updated GitHub Actions workflow to disable handling of large packages in free-disk-space action. Improved logging in plugin verification to provide clearer details about available and selected builds for verification. * Updated change log. * Reverted build and changelog steps * Bumped version
1 parent 2d0bfc9 commit a5512d5

15 files changed

+224
-144
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ jobs:
157157
uses: jlumbroso/free-disk-space@main
158158
with:
159159
tool-cache: false
160+
large-packages: false
160161

161162
# Check out the current repository
162163
- name: Fetch Sources
@@ -190,6 +191,7 @@ jobs:
190191
uses: jlumbroso/free-disk-space@main
191192
with:
192193
tool-cache: false
194+
large-packages: false
193195

194196
# Check out the current repository
195197
- name: Fetch Sources

.run/Run Verifications.run.xml

Lines changed: 0 additions & 25 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44

55
## [Unreleased]
66

7-
## [0.0.1] - 2022-11-09
7+
### Added
8+
9+
- Added an option to disable the plugin for large files.
10+
- Added service optimizations for performance gains.
11+
12+
## [0.0.1] - 2024-11-09
813

914
### Added
1015

1116
- Initial release
1217

1318
[Unreleased]: https://github.com/j-d-ha/brackets/compare/v0.0.1...HEAD
19+
1420
[0.0.1]: https://github.com/j-d-ha/brackets/commits/v0.0.1

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@ match VSCode.
1818

1919
> Note: As of now, I don't plan on adding support for any other languages.
2020
21+
## Settings
22+
23+
Plugin settings can be found in <kbd>Settings/Preferences</kbd> > <kbd>Tools</kbd> > <kbd>
24+
Brackets</kbd>.
25+
26+
Bellow is a list available settings:
27+
28+
- Matching bracket pair colorization can be disabled for large files. This functionality and the
29+
line
30+
count threshold for large files can be updated in settings.
31+
2132
<!-- Plugin description end -->
2233

2334
## Installation

build.gradle.kts

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import java.io.FileReader
22
import java.util.Properties
3-
import org.gradle.kotlin.dsl.assign
43
import org.jetbrains.changelog.Changelog
54
import org.jetbrains.changelog.markdownToHTML
65
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
@@ -15,19 +14,19 @@ File(".env").takeIf(File::exists)?.let {
1514

1615
plugins {
1716
id("java") // Java support
18-
alias(libs.plugins.kotlin) version "2.0.21" // Kotlin support
19-
alias(libs.plugins.intelliJPlatform) version "2.1.0" // IntelliJ Platform Gradle Plugin
17+
alias(libs.plugins.kotlin) // Kotlin support
18+
alias(libs.plugins.intelliJPlatform) // IntelliJ Platform Gradle Plugin
2019
alias(libs.plugins.changelog) // Gradle Changelog Plugin
2120
alias(libs.plugins.qodana) // Gradle Qodana Plugin
2221
alias(libs.plugins.kover) // Gradle Kover Plugin
2322
}
2423

2524
group = providers.gradleProperty("pluginGroup").get()
2625

27-
version = project.changelog.getAll().keys.toList().first { Regex("""\d+\.\d+\.\d+""").matches(it) }
26+
version = providers.gradleProperty("pluginVersion").get()
2827

2928
// Set the JVM language level used to build the project.
30-
kotlin { jvmToolchain(17) }
29+
kotlin { jvmToolchain(21) }
3130

3231
// Configure project's dependencies
3332
repositories {
@@ -51,8 +50,6 @@ dependencies {
5150
providers.gradleProperty("platformVersion"),
5251
)
5352

54-
// local(file("/Users/jonasha/Applications/Rider.app/Contents"))
55-
5653
// Plugin Dependencies. Uses `platformBundledPlugins` property from the gradle.properties
5754
// file for bundled IntelliJ Platform plugins.
5855
bundledPlugins(providers.gradleProperty("platformBundledPlugins").map { it.split(',') })
@@ -61,27 +58,16 @@ dependencies {
6158
// plugin from JetBrains Marketplace.
6259
plugins(providers.gradleProperty("platformPlugins").map { it.split(',') })
6360

64-
instrumentationTools()
65-
pluginVerifier()
66-
zipSigner()
6761
testFramework(TestFrameworkType.Platform)
6862
}
6963
}
7064

71-
idea {
72-
module {
73-
isDownloadJavadoc = true
74-
isDownloadSources = true
75-
}
76-
}
77-
7865
// Configure IntelliJ Platform Gradle Plugin - read more:
7966
// https://plugins.jetbrains.com/docs/intellij/tools-intellij-platform-gradle-plugin-extension.html
8067
intellijPlatform {
8168
pluginConfiguration {
82-
val changelog = project.changelog // local variable for configuration cache compatibility
83-
84-
version = changelog.getAll().keys.toList().first { Regex("""\d+\.\d+\.\d+""").matches(it) }
69+
name = providers.gradleProperty("pluginName")
70+
version = providers.gradleProperty("pluginVersion")
8571

8672
// Extract the <!-- Plugin description --> section from README.md and provide for the
8773
// plugin's manifest
@@ -102,6 +88,7 @@ intellijPlatform {
10288
}
10389
}
10490

91+
val changelog = project.changelog // local variable for configuration cache compatibility
10592
// Get the latest available change notes from the changelog file
10693
changeNotes =
10794
providers.gradleProperty("pluginVersion").map { pluginVersion ->
@@ -122,14 +109,13 @@ intellijPlatform {
122109
}
123110

124111
signing {
125-
password.set(providers.environmentVariable("PRIVATE_KEY_PASSWORD"))
126-
certificateChain.set(providers.environmentVariable("CERTIFICATE_CHAIN"))
127-
privateKey.set(providers.environmentVariable("PRIVATE_KEY"))
112+
certificateChain = providers.environmentVariable("CERTIFICATE_CHAIN")
113+
privateKey = providers.environmentVariable("PRIVATE_KEY")
114+
password = providers.environmentVariable("PRIVATE_KEY_PASSWORD")
128115
}
129116

130117
publishing {
131-
token.set(providers.environmentVariable("PUBLISH_TOKEN"))
132-
118+
token = providers.environmentVariable("PUBLISH_TOKEN")
133119
// The pluginVersion is based on the SemVer (https://semver.org) and supports pre-release
134120
// labels, like 2.1.7-alpha.3
135121
// Specify pre-release label to publish the plugin in a custom Release Channel
@@ -141,7 +127,22 @@ intellijPlatform {
141127
}
142128
}
143129

144-
pluginVerification { ides { recommended() } }
130+
pluginVerification {
131+
ides {
132+
val productReleases = ProductReleasesValueSource().get()
133+
println(
134+
"The following builds are available in the verification range: $productReleases"
135+
)
136+
137+
val reducedProductReleases =
138+
if (productReleases.size > 2)
139+
listOf(productReleases.first(), productReleases.last())
140+
else productReleases
141+
println("Running pluginVerification for the following builds: $reducedProductReleases")
142+
143+
ides(reducedProductReleases)
144+
}
145+
}
145146
}
146147

147148
// Configure Gradle Changelog Plugin - read more:

gradle.properties

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@ pluginGroup=com.github.jdha.brackets
33
pluginName=brackets
44
pluginRepositoryUrl=https://github.com/j-d-ha/brackets
55
# SemVer format -> https://semver.org
6-
pluginVersion=0.0.1
6+
pluginVersion=0.0.2
77
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
88
pluginSinceBuild=233
9-
#pluginUntilBuild = 242.*
9+
#pluginUntilBuild=
1010
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
1111
platformType=RD
12-
platformVersion=2024.2.7
13-
#platformType=IC
14-
#platformVersion=2024.2.4
12+
platformVersion=2025.1
1513
# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
1614
# Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP
1715
platformPlugins=
1816
# Example: platformBundledPlugins = com.intellij.java, com.jetbrains.rider.fsharp
1917
platformBundledPlugins=
2018
# Gradle Releases -> https://github.com/gradle/gradle/releases
21-
gradleVersion=8.10.2
19+
gradleVersion=8.14
2220
# Opt-out flag for bundling Kotlin standard library -> https://jb.gg/intellij-platform-kotlin-stdlib
2321
kotlin.stdlib.default.dependency=false
2422
# Enable Gradle Configuration Cache -> https://docs.gradle.org/current/userguide/configuration_cache.html

src/main/kotlin/com/github/jdha/brackets/annotator/CSBracketColorizer.kt renamed to src/main/kotlin/com/github/jdha/brackets/annotator/CSBracketColorizerAnnotator.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717

1818
package com.github.jdha.brackets.annotator
1919

20+
import com.github.jdha.brackets.services.BracketColorizerServiceFactory
21+
import com.github.jdha.brackets.services.BracketColorizerType
2022
import com.intellij.lang.annotation.AnnotationHolder
2123
import com.intellij.lang.annotation.Annotator
24+
import com.intellij.openapi.components.service
2225
import com.intellij.psi.PsiElement
2326

24-
class CSBracketColorizer : Annotator {
25-
26-
private val colorizer = BracketColorizer.default()
27+
class CSBracketColorizerAnnotator : Annotator {
2728

2829
/**
2930
* This function is called by the plugin to annotate a given element of the PSI structure.
3031
*
3132
* @param p0 the element to annotate
3233
* @param p1 the annotation holder to which color annotations are added
3334
*/
34-
override fun annotate(p0: PsiElement, p1: AnnotationHolder) {
35-
colorizer.colorize(p0, p1)
36-
}
35+
override fun annotate(p0: PsiElement, p1: AnnotationHolder) =
36+
service<BracketColorizerServiceFactory>().get(BracketColorizerType.CSharp).colorize(p0, p1)
3737
}

src/main/kotlin/com/github/jdha/brackets/annotator/FSBracketColorizer.kt renamed to src/main/kotlin/com/github/jdha/brackets/annotator/FSBracketColorizerAnnotator.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717

1818
package com.github.jdha.brackets.annotator
1919

20+
import com.github.jdha.brackets.services.BracketColorizerServiceFactory
21+
import com.github.jdha.brackets.services.BracketColorizerType
2022
import com.intellij.lang.annotation.AnnotationHolder
2123
import com.intellij.lang.annotation.Annotator
24+
import com.intellij.openapi.components.service
2225
import com.intellij.psi.PsiElement
2326

24-
class FSBracketColorizer : Annotator {
25-
26-
private val colorizer = BracketColorizer.withAdditionalBrackets(setOf("[<"), setOf(">]"))
27+
class FSBracketColorizerAnnotator : Annotator {
2728

2829
/**
2930
* This function is called by the plugin to annotate a given element of the PSI structure.
3031
*
3132
* @param p0 the element to annotate
3233
* @param p1 the annotation holder to which color annotations are added
3334
*/
34-
override fun annotate(p0: PsiElement, p1: AnnotationHolder) {
35-
colorizer.colorize(p0, p1)
36-
}
35+
override fun annotate(p0: PsiElement, p1: AnnotationHolder) =
36+
service<BracketColorizerServiceFactory>().get(BracketColorizerType.FSharp).colorize(p0, p1)
3737
}

0 commit comments

Comments
 (0)