backport: 20.0.1
This commit is contained in:
parent
d1739d85e5
commit
39faf77f4f
9 changed files with 29 additions and 29 deletions
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
|
@ -1,2 +1,2 @@
|
|||
patreon: falsepattern
|
||||
ko-fi: falsepattern
|
||||
ko_fi: falsepattern
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -60,4 +60,5 @@ gradle-app.setting
|
|||
.intellijPlatform
|
||||
jbr
|
||||
secrets
|
||||
!**/src/**/build/
|
||||
!**/src/**/build/
|
||||
.kotlin
|
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -17,6 +17,17 @@ Changelog structure reference:
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [20.0.1]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Project
|
||||
- IDE freezes when opening a zig project / doing zig init
|
||||
- Test tasks don't work and try to run the file as an executable
|
||||
|
||||
- Zig
|
||||
- Struct fields being styled as static fields instead of instance fields
|
||||
|
||||
## [20.0.0]
|
||||
|
||||
### Added
|
||||
|
|
|
@ -146,6 +146,8 @@ intellijPlatform {
|
|||
sinceBuild = pluginSinceBuild
|
||||
if (pluginUntilBuild.isNotBlank()) {
|
||||
untilBuild = pluginUntilBuild
|
||||
} else {
|
||||
untilBuild = provider { null }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ class ZigExecConfigTest(project: Project, factory: ConfigurationFactory): ZigExe
|
|||
@Throws(ExecutionException::class)
|
||||
override suspend fun buildCommandLineArgs(debug: Boolean): List<String> {
|
||||
val result = ArrayList<String>()
|
||||
result.add(if (debug) "build-exe" else "run")
|
||||
result.add("test")
|
||||
result.addAll(coloredCliFlags(colored.value, debug))
|
||||
result.add(filePath.path?.pathString ?: throw ExecutionException(ZigBrainsBundle.message("exception.zig.empty-file-path")))
|
||||
if (!debug || optimization.forced) {
|
||||
|
|
|
@ -25,25 +25,22 @@ package com.falsepattern.zigbrains.project.toolchain.stdlib
|
|||
import com.falsepattern.zigbrains.Icons
|
||||
import com.falsepattern.zigbrains.project.settings.ZigProjectSettings
|
||||
import com.falsepattern.zigbrains.project.settings.zigProjectSettings
|
||||
import com.falsepattern.zigbrains.shared.coroutine.getOrAwaitModalOrBlocking
|
||||
import com.falsepattern.zigbrains.shared.zigCoroutineScope
|
||||
import com.intellij.navigation.ItemPresentation
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.SyntheticLibrary
|
||||
import com.intellij.openapi.util.io.toNioPathOrNull
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.openapi.vfs.refreshAndFindVirtualDirectory
|
||||
import com.intellij.platform.ide.progress.ModalTaskOwner
|
||||
import com.intellij.util.suspendingLazy
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.util.*
|
||||
import javax.swing.Icon
|
||||
|
||||
class ZigSyntheticLibrary(val project: Project) : SyntheticLibrary(), ItemPresentation {
|
||||
private val roots = project.zigCoroutineScope.suspendingLazy {
|
||||
private val roots by lazy {
|
||||
getRoots(project.zigProjectSettings.state, project)
|
||||
}
|
||||
|
||||
private val name = project.zigCoroutineScope.suspendingLazy {
|
||||
private val name by lazy {
|
||||
getName(project.zigProjectSettings.state, project)
|
||||
}
|
||||
|
||||
|
@ -59,7 +56,7 @@ class ZigSyntheticLibrary(val project: Project) : SyntheticLibrary(), ItemPresen
|
|||
}
|
||||
|
||||
override fun getPresentableText(): String {
|
||||
return name.getOrAwaitModalOrBlocking({ModalTaskOwner.project(project)}, {"ZigSyntheticLibrary.getPresentableText"})
|
||||
return name
|
||||
}
|
||||
|
||||
override fun getIcon(unused: Boolean): Icon {
|
||||
|
@ -67,28 +64,28 @@ class ZigSyntheticLibrary(val project: Project) : SyntheticLibrary(), ItemPresen
|
|||
}
|
||||
|
||||
override fun getSourceRoots(): Collection<VirtualFile> {
|
||||
return roots.getOrAwaitModalOrBlocking({ ModalTaskOwner.project(project)}, {"ZigSyntheticLibrary.getSourceRoots"})
|
||||
return roots
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private suspend fun getName(
|
||||
private fun getName(
|
||||
state: ZigProjectSettings,
|
||||
project: Project
|
||||
): String {
|
||||
val tc = state.toolchain ?: return "Zig"
|
||||
val version = tc.zig.getEnv(project).version
|
||||
val version = runBlocking { tc.zig.getEnv(project).version }
|
||||
return "Zig $version"
|
||||
}
|
||||
|
||||
private suspend fun getRoots(
|
||||
private fun getRoots(
|
||||
state: ZigProjectSettings,
|
||||
project: Project
|
||||
): Set<VirtualFile> {
|
||||
val toolchain = state.toolchain
|
||||
run {
|
||||
if (state.overrideStdPath) run {
|
||||
val ePathStr = state.explicitPathToStd ?: return@run
|
||||
val ePath = ePathStr.toNioPathOrNull() ?: return@run
|
||||
if (ePath.isAbsolute) {
|
||||
|
@ -103,7 +100,7 @@ private suspend fun getRoots(
|
|||
}
|
||||
}
|
||||
if (toolchain != null) {
|
||||
val stdPath = toolchain.zig.getEnv(project).stdPath(toolchain, project) ?: return emptySet()
|
||||
val stdPath = runBlocking { toolchain.zig.getEnv(project) }.stdPath(toolchain, project) ?: return emptySet()
|
||||
val roots = stdPath.refreshAndFindVirtualDirectory() ?: return emptySet()
|
||||
return setOf(roots)
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import com.intellij.openapi.application.asContextElement
|
|||
import com.intellij.platform.ide.progress.ModalTaskOwner
|
||||
import com.intellij.platform.ide.progress.TaskCancellation
|
||||
import com.intellij.platform.ide.progress.runWithModalProgressBlocking
|
||||
import com.intellij.util.SuspendingLazy
|
||||
import com.intellij.util.application
|
||||
import kotlinx.coroutines.*
|
||||
|
||||
|
@ -40,16 +39,6 @@ inline fun <T> runModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleF
|
|||
}
|
||||
}
|
||||
|
||||
inline fun <T> SuspendingLazy<T>.getOrAwaitModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleFactory: () -> String, cancellationFactory: () -> TaskCancellation = TaskCancellation::cancellable): T {
|
||||
if (isInitialized()) {
|
||||
return getInitialized()
|
||||
} else {
|
||||
return runModalOrBlocking(taskOwnerFactory, titleFactory, cancellationFactory) {
|
||||
getValue()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend inline fun <T> withEDTContext(state: ModalityState = ModalityState.defaultModalityState(), noinline block: suspend CoroutineScope.() -> T): T {
|
||||
return withContext(Dispatchers.EDT + state.asContextElement(), block = block)
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ class ZigSyntaxHighlighter: SyntaxHighlighterBase() {
|
|||
val ENUM_MEMBER_REF = createKey("ENUM_MEMBER" , ENUM_MEMBER_DECL )
|
||||
val ERROR_TAG_DECL = createKey("ERROR_TAG_DECL" , DefaultLanguageHighlighterColors.STATIC_FIELD )
|
||||
val ERROR_TAG_REF = createKey("ERROR_TAG" , ERROR_TAG_DECL )
|
||||
val PROPERTY_DECL = createKey("PROPERTY_DECL" , DefaultLanguageHighlighterColors.STATIC_FIELD )
|
||||
val PROPERTY_DECL = createKey("PROPERTY_DECL" , DefaultLanguageHighlighterColors.INSTANCE_FIELD )
|
||||
val PROPERTY_REF = createKey("PROPERTY" , PROPERTY_DECL )
|
||||
val FUNCTION_DECL = createKey("FUNCTION_DECL" , DefaultLanguageHighlighterColors.FUNCTION_DECLARATION )
|
||||
val FUNCTION_DECL_GEN = createKey("FUNCTION_DECL_GEN" , FUNCTION_DECL )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
pluginName=ZigBrains
|
||||
pluginRepositoryUrl=https://github.com/FalsePattern/ZigBrains
|
||||
|
||||
pluginVersion=20.0.0
|
||||
pluginVersion=20.0.1
|
||||
|
||||
pluginSinceBuild=242
|
||||
pluginUntilBuild=242.*
|
||||
|
|
Loading…
Add table
Reference in a new issue