Compare commits

...

5 commits

13 changed files with 76 additions and 13 deletions

View file

@ -17,6 +17,15 @@ Changelog structure reference:
## [Unreleased] ## [Unreleased]
## [25.1.0]
### Added
- IDEA 2025.1 support
- LSP
- Configurable inlay hints file size limit to reduce IDE lag
## [25.0.2] ## [25.0.2]
### Fixed ### Fixed

View file

@ -15,6 +15,7 @@ through the built-in plugin browser:
1. Go to `Settings -> Plugins` 1. Go to `Settings -> Plugins`
2. To the right of the `Installed` button at the top, click on the `...` dropdown menu, then select `Manage Plugin Repositories...` 2. To the right of the `Installed` button at the top, click on the `...` dropdown menu, then select `Manage Plugin Repositories...`
3. Click the add button, and then enter the ZigBrains updater URL, based on your IDE version: 3. Click the add button, and then enter the ZigBrains updater URL, based on your IDE version:
- `2025.1.*` or newer: https://falsepattern.com/zigbrains/updatePlugins-251.xml
- `2024.3.*`: https://falsepattern.com/zigbrains/updatePlugins-243.xml - `2024.3.*`: https://falsepattern.com/zigbrains/updatePlugins-243.xml
- `2024.2.*`: https://falsepattern.com/zigbrains/updatePlugins-242.xml - `2024.2.*`: https://falsepattern.com/zigbrains/updatePlugins-242.xml
- `2024.1.*`: https://falsepattern.com/zigbrains/updatePlugins-241.xml - `2024.1.*`: https://falsepattern.com/zigbrains/updatePlugins-241.xml

View file

@ -6,15 +6,15 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
plugins { plugins {
kotlin("jvm") version "2.0.21" apply false kotlin("jvm") version "2.1.10" apply false
kotlin("plugin.serialization") version "2.0.21" apply false kotlin("plugin.serialization") version "2.1.10" apply false
id("org.jetbrains.intellij.platform") version "2.5.0" id("org.jetbrains.intellij.platform") version "2.5.0"
id("org.jetbrains.changelog") version "2.2.1" id("org.jetbrains.changelog") version "2.2.1"
id("org.jetbrains.grammarkit") version "2022.3.2.2" apply false id("org.jetbrains.grammarkit") version "2022.3.2.2" apply false
idea idea
`maven-publish` `maven-publish`
} }
val publishVersions = listOf("241", "242", "243") val publishVersions = listOf("241", "242", "243", "251")
val pluginVersionFull get() = "$pluginVersion-$pluginSinceBuild" val pluginVersionFull get() = "$pluginVersion-$pluginSinceBuild"
val pluginVersion: String by project val pluginVersion: String by project
val pluginSinceBuild: String by project val pluginSinceBuild: String by project

View file

@ -23,7 +23,7 @@
set -e set -e
declare -a branches=("master" "242" "241") declare -a branches=("master" "243" "242" "241")
DEFAULT_BRANCH="${branches[0]}" DEFAULT_BRANCH="${branches[0]}"

View file

@ -58,7 +58,8 @@ class ZigClionDebuggerDriverConfigurationProvider: ZigDebuggerDriverConfiguratio
return when(toolchain.debuggerKind) { return when(toolchain.debuggerKind) {
CPPDebugger.Kind.BUNDLED_GDB, CPPDebugger.Kind.BUNDLED_GDB,
CPPDebugger.Kind.CUSTOM_GDB -> CLionGDBDriverConfiguration(project, toolchain, isEmulateTerminal = emulateTerminal) CPPDebugger.Kind.CUSTOM_GDB -> CLionGDBDriverConfiguration(project, toolchain, isEmulateTerminal = emulateTerminal)
CPPDebugger.Kind.BUNDLED_LLDB -> CLionLLDBDriverConfiguration(project, toolchain, isEmulateTerminal = emulateTerminal) CPPDebugger.Kind.BUNDLED_LLDB,
CPPDebugger.Kind.CUSTOM_LLDB -> CLionLLDBDriverConfiguration(project, toolchain, isEmulateTerminal = emulateTerminal)
} }
} }
} }

View file

@ -9,12 +9,15 @@ plugins {
val ideaCommunityVersion: String by project val ideaCommunityVersion: String by project
val useInstaller = property("useInstaller").toString().toBoolean() val useInstaller = property("useInstaller").toString().toBoolean()
val serializationVersion: String by project
dependencies { dependencies {
intellijPlatform { intellijPlatform {
create(IntelliJPlatformType.IntellijIdeaCommunity, ideaCommunityVersion, useInstaller = useInstaller) create(IntelliJPlatformType.IntellijIdeaCommunity, ideaCommunityVersion, useInstaller = useInstaller)
} }
compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3") compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:$serializationVersion") {
isTransitive = false
}
} }
//region grammars //region grammars

View file

@ -1,13 +1,13 @@
pluginName=ZigBrains pluginName=ZigBrains
pluginRepositoryUrl=https://github.com/FalsePattern/ZigBrains pluginRepositoryUrl=https://github.com/FalsePattern/ZigBrains
pluginVersion=25.0.2 pluginVersion=25.1.0
pluginSinceBuild=243 pluginSinceBuild=251
pluginUntilBuild= pluginUntilBuild=
ideaCommunityVersion=2024.3 ideaCommunityVersion=2025.1
clionVersion=2024.3 clionVersion=2025.1
useInstaller=true useInstaller=true
javaVersion=21 javaVersion=21
# ideaCommunity / clion # ideaCommunity / clion
@ -17,6 +17,8 @@ lsp4jVersion=0.21.1
lsp4ijVersion=0.12.0 lsp4ijVersion=0.12.0
lsp4ijNightly=false lsp4ijNightly=false
serializationVersion=1.7.3
kotlin.stdlib.default.dependency=false kotlin.stdlib.default.dependency=false
kotlin.code.style=official kotlin.code.style=official
org.gradle.configuration-cache=true org.gradle.configuration-cache=true

View file

@ -8,12 +8,15 @@ val lsp4ijVersion: String by project
val lsp4jVersion: String by project val lsp4jVersion: String by project
val ideaCommunityVersion: String by project val ideaCommunityVersion: String by project
val useInstaller = property("useInstaller").toString().toBoolean() val useInstaller = property("useInstaller").toString().toBoolean()
val serializationVersion: String by project
dependencies { dependencies {
intellijPlatform { intellijPlatform {
create(IntelliJPlatformType.IntellijIdeaCommunity, ideaCommunityVersion, useInstaller = useInstaller) create(IntelliJPlatformType.IntellijIdeaCommunity, ideaCommunityVersion, useInstaller = useInstaller)
} }
compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-core:1.7.3") compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:$serializationVersion") {
isTransitive = false
}
compileOnly("com.redhat.devtools.intellij:lsp4ij:$lsp4ijVersion") compileOnly("com.redhat.devtools.intellij:lsp4ij:$lsp4ijVersion")
compileOnly("org.eclipse.lsp4j:org.eclipse.lsp4j:$lsp4jVersion") compileOnly("org.eclipse.lsp4j:org.eclipse.lsp4j:$lsp4jVersion")
implementation(project(":core")) { implementation(project(":core")) {

View file

@ -68,7 +68,14 @@ class ZigLanguageServerFactory: LanguageServerFactory, LanguageServerEnablementS
} }
features.inlayHintFeature = object: LSPInlayHintFeature() { features.inlayHintFeature = object: LSPInlayHintFeature() {
override fun isEnabled(file: PsiFile): Boolean { override fun isEnabled(file: PsiFile): Boolean {
return project.zls?.settings?.inlayHints == true val settings = project.zls?.settings ?: return false
if (!settings.inlayHints)
return false
val maxFileSizeKb = settings.inlayHintsMaxFileSizeKb
if (maxFileSizeKb == 0)
return true
val fileSizeKb = file.fileDocument.textLength / 1024
return fileSizeKb <= maxFileSizeKb
} }
} }
return features return features

View file

@ -30,6 +30,7 @@ import org.jetbrains.annotations.NonNls
data class ZLSSettings( data class ZLSSettings(
@JvmField @Attribute val zlsConfigPath: @NonNls String = "", @JvmField @Attribute val zlsConfigPath: @NonNls String = "",
@JvmField @Attribute val inlayHints: Boolean = true, @JvmField @Attribute val inlayHints: Boolean = true,
@JvmField @Attribute val inlayHintsMaxFileSizeKb: Int = 128,
@JvmField @Attribute val enable_snippets: Boolean = true, @JvmField @Attribute val enable_snippets: Boolean = true,
@JvmField @Attribute val enable_argument_placeholders: Boolean = true, @JvmField @Attribute val enable_argument_placeholders: Boolean = true,
@JvmField @Attribute val completion_label_details: Boolean = true, @JvmField @Attribute val completion_label_details: Boolean = true,

View file

@ -35,6 +35,9 @@ import com.intellij.ui.dsl.builder.AlignX
import com.intellij.ui.dsl.builder.Panel import com.intellij.ui.dsl.builder.Panel
import com.intellij.ui.dsl.builder.Row import com.intellij.ui.dsl.builder.Row
import org.jetbrains.annotations.PropertyKey import org.jetbrains.annotations.PropertyKey
import javax.swing.text.AttributeSet
import javax.swing.text.DocumentFilter
import javax.swing.text.PlainDocument
@Suppress("PrivatePropertyName") @Suppress("PrivatePropertyName")
class ZLSSettingsPanel() : ImmutableElementPanel<ZLSSettings> { class ZLSSettingsPanel() : ImmutableElementPanel<ZLSSettings> {
@ -44,6 +47,27 @@ class ZLSSettingsPanel() : ImmutableElementPanel<ZLSSettings> {
.withTitle(ZLSBundle.message("settings.zls-config-path.browse.title")) .withTitle(ZLSBundle.message("settings.zls-config-path.browse.title"))
).also { Disposer.register(this, it) } ).also { Disposer.register(this, it) }
private val inlayHints = JBCheckBox() private val inlayHints = JBCheckBox()
private val inlayHintsMaxFileSize = ExtendableTextField(5).also { (it.document as PlainDocument).documentFilter = object: DocumentFilter() {
override fun insertString(fb: FilterBypass?, offset: Int, string: String?, attr: AttributeSet?) {
if (string != null && !string.isEmpty() && string.toIntOrNull() == null) {
return
}
super.insertString(fb, offset, string, attr)
}
override fun replace(
fb: FilterBypass?,
offset: Int,
length: Int,
text: String?,
attrs: AttributeSet?
) {
if (text != null && !text.isEmpty() && text.toIntOrNull() == null) {
return
}
super.replace(fb, offset, length, text, attrs)
}
} }
private val enable_snippets = JBCheckBox() private val enable_snippets = JBCheckBox()
private val enable_argument_placeholders = JBCheckBox() private val enable_argument_placeholders = JBCheckBox()
private val completion_label_details = JBCheckBox() private val completion_label_details = JBCheckBox()
@ -99,6 +123,13 @@ class ZLSSettingsPanel() : ImmutableElementPanel<ZLSSettings> {
"settings.inlay-hints-enable.label", "settings.inlay-hints-enable.label",
"settings.inlay-hints-enable.tooltip" "settings.inlay-hints-enable.tooltip"
) { cell(inlayHints) } ) { cell(inlayHints) }
fancyRow(
"settings.inlay-hints-max-size.label",
"settings.inlay-hints-max-size.tooltip",
) {
cell(inlayHintsMaxFileSize)
text(ZLSBundle.message("settings.inlay-hints-max-size.unit"))
}
fancyRow( fancyRow(
"settings.inlay_hints_show_variable_type_hints.label", "settings.inlay_hints_show_variable_type_hints.label",
"settings.inlay_hints_show_variable_type_hints.tooltip" "settings.inlay_hints_show_variable_type_hints.tooltip"
@ -174,6 +205,7 @@ class ZLSSettingsPanel() : ImmutableElementPanel<ZLSSettings> {
get() = ZLSSettings( get() = ZLSSettings(
zlsConfigPath.text, zlsConfigPath.text,
inlayHints.isSelected, inlayHints.isSelected,
inlayHintsMaxFileSize.text.toIntOrNull() ?: 128,
enable_snippets.isSelected, enable_snippets.isSelected,
enable_argument_placeholders.isSelected, enable_argument_placeholders.isSelected,
completion_label_details.isSelected, completion_label_details.isSelected,
@ -198,6 +230,7 @@ class ZLSSettingsPanel() : ImmutableElementPanel<ZLSSettings> {
set(value) { set(value) {
zlsConfigPath.text = value.zlsConfigPath zlsConfigPath.text = value.zlsConfigPath
inlayHints.isSelected = value.inlayHints inlayHints.isSelected = value.inlayHints
inlayHintsMaxFileSize.text = value.inlayHintsMaxFileSizeKb.toString()
enable_snippets.isSelected = value.enable_snippets enable_snippets.isSelected = value.enable_snippets
enable_argument_placeholders.isSelected = value.enable_argument_placeholders enable_argument_placeholders.isSelected = value.enable_argument_placeholders
completion_label_details.isSelected = value.completion_label_details completion_label_details.isSelected = value.completion_label_details

View file

@ -4,6 +4,9 @@ settings.zls-config-path.browse.title=Path to the Custom ZLS Config File (Option
settings.inlay-hints-group.label=Inlay Hints settings.inlay-hints-group.label=Inlay Hints
settings.inlay-hints-enable.label=Enable settings.inlay-hints-enable.label=Enable
settings.inlay-hints-enable.tooltip=Toggle this to enable/disable all inlay hints settings.inlay-hints-enable.tooltip=Toggle this to enable/disable all inlay hints
settings.inlay-hints-max-size.label=Maximum Size
settings.inlay-hints-max-size.tooltip=The maximum size of a zig file to show inlay hints for.\nInlay hints in very large files make the IDE lag.\nSet to 0 to disable.
settings.inlay-hints-max-size.unit=KB
settings.enable_snippets.label=Enable snippets settings.enable_snippets.label=Enable snippets
settings.enable_snippets.tooltip=Enables snippet completions when the client also supports them settings.enable_snippets.tooltip=Enables snippet completions when the client also supports them
settings.enable_argument_placeholders.label=Enable argument placeholders settings.enable_argument_placeholders.label=Enable argument placeholders

View file

@ -23,7 +23,7 @@
set -e set -e
declare -a branches=("dev" "master" "242" "241") declare -a branches=("dev" "master" "243" "242" "241")
die () { die () {
echo >&2 "$@" echo >&2 "$@"