Compare commits

..

176 commits
241 ... master

Author SHA1 Message Date
0032dbf0f3
ci: 25.2.0 2025-04-20 16:10:20 +02:00
e7f0bb793a
feat: build.zig integration for run and test line markers 2025-04-20 15:57:37 +02:00
532292068f
feat: debugger improved error message for failed compilation 2025-04-20 15:56:21 +02:00
dd2104065c
ci: update push.sh 2025-04-17 13:57:44 +02:00
8389c66814
ci: 25.1.0 2025-04-17 13:53:19 +02:00
803b25d7fb
fix: [NO BACKPORT] update cpp debugger resolution logic 2025-04-17 13:43:08 +02:00
b3ce6d62a7
ci: add 251 to build and docs 2025-04-17 13:43:08 +02:00
f28cf77347
ci: [NO BACKPORT] switch to IDE 2025.1 2025-04-17 13:42:57 +02:00
c524bbf899
feat: Inlay hint file size limit option 2025-04-17 09:39:10 +02:00
a9c8a3a0d9
ci: 25.0.2 2025-04-16 00:42:41 +02:00
570eeac755
chore: fix some kotlin linter warnings 2025-04-16 00:42:34 +02:00
5efc28ae18
chore: cache suggestion paths 2025-04-16 00:31:25 +02:00
91747319aa
fix: non-scrollable ZLS settings 2025-04-16 00:17:02 +02:00
8a7ca04168
ci: 25.0.1 emergency hotfix 2025-04-11 18:51:27 +02:00
5e4f2d5dfb
ci: 25.0.0 2025-04-11 18:00:43 +02:00
4722613b4c
chore: optimize imports 2025-04-11 18:00:35 +02:00
53f4d1d330
feat: Hide library root if zig not configured 2025-04-11 17:47:33 +02:00
270ac9e113
fix: ZLS config not serializing 2025-04-11 17:32:58 +02:00
a4db054b59
fix: Config shows changed when not yet initialized 2025-04-11 17:32:46 +02:00
bd47cb201f
chore: Add lang for ZLS management 2025-04-11 17:19:54 +02:00
520167414a
docs: update readme 2025-04-11 17:19:52 +02:00
2d0ad8be44
ci: update changelog 2025-04-11 17:19:49 +02:00
9913ceb67e
ci: add etag check to debugger properties download 2025-04-11 17:19:48 +02:00
d5359e5816
feat!: Toolchain rework 2025-04-11 17:19:44 +02:00
8336d2bcc5
toolchain+lsp management feature complete! 2025-04-11 16:47:01 +02:00
281ce0ed4e
almost feature complete - ZLS needs settings GUI 2025-04-11 02:30:17 +02:00
dcede7eb43
initial LSP work 2025-04-10 20:10:27 +02:00
137977f691
modular toolchain config 2025-04-10 17:28:56 +02:00
ab20a57e9e
abstract away UUID storage for LSP code sharing 2025-04-10 16:55:30 +02:00
1725b189a4
wire up synthetic library reloads to new config 2025-04-10 12:14:23 +02:00
68b60e2c77
direnv decoupling 2025-04-10 11:27:22 +02:00
f7ea73ae45
tristate direnv config 2025-04-10 04:14:31 +02:00
3ceb61f2dd
async toolchain resolution and other tweaks 2025-04-10 01:44:43 +02:00
c7e33ea8de
modular project configurables 2025-04-09 23:20:40 +02:00
12e5ffdea1
finishing touches for the toolchain selector 2025-04-09 22:35:44 +02:00
54cd514249
local zig toolchain name, edit button state, sorted recommends 2025-04-09 18:29:06 +02:00
a8f97172d6
ported core to new toolchain api
direnv and zls regressed for now
2025-04-09 16:44:01 +02:00
b485c1e48c
lang for toolchain 2025-04-09 00:48:08 +02:00
ee5a2463b9
fully functional selection logic 2025-04-08 00:36:44 +02:00
9676b70821
Working change sync and downloader 2025-04-07 02:38:12 +02:00
9023026478
nicer suggestion/actual toolchain rendering 2025-04-06 17:31:10 +02:00
8bb4e8bef1
project-level toolchain selector 2025-04-06 17:19:26 +02:00
9541bb9752
refactor toolchain directory structure 2025-04-06 12:10:31 +02:00
2c500d40a5
work work work 2025-04-06 02:25:22 +02:00
e737058cb5
more progress 2025-04-05 19:46:48 +02:00
f53b0e3283
begin implementation of multi-toolchain management 2025-04-05 13:33:31 +02:00
3de2f92bf8
ci: update to lsp4ij 0.12.0 2025-04-04 16:54:15 +02:00
dec12a8041
ci: make cross-subproject dependencies non-transitive 2025-04-04 16:43:25 +02:00
ac90dab503
ci: update gradle dependencies 2025-04-04 16:43:08 +02:00
9830b7ebc9
ci: 24.0.1 2025-03-27 23:04:48 +01:00
efa2f127a9
fix!: bad modality states in some EDT calls 2025-03-27 23:04:16 +01:00
78c4751c53
ci: 24.0.0 2025-03-27 22:06:04 +01:00
1f79f484e5
fix: Make EDT coroutine modality state explicit everywhere and fix deadlocks 2025-03-27 22:05:02 +01:00
6c14ad7113
chore: fix kotlin compiler warnings 2025-03-27 21:36:52 +01:00
ab5948a51b
chore: remove obsolete lang keys 2025-03-27 20:53:00 +01:00
a950c932f5
fix: show build errors in console properly 2025-03-27 20:51:19 +01:00
46069b9a22
fix: file path browse buttons in run configs 2025-03-27 20:50:36 +01:00
0a5a765eaf
feat!: TTY support for zig processes 2025-03-27 20:49:50 +01:00
da38433eb3
fix: IPC wrapper pass exit code 2025-03-27 20:40:47 +01:00
7c1aa36d82
ci: 23.1.2 2025-03-27 11:50:33 +01:00
ceea101170
fix: IDE warning when renaming symbols 2025-03-27 11:49:50 +01:00
6dacf97583
ci: 23.1.1 2025-03-26 23:33:53 +01:00
b497f04e40
fix: ignore zls settings panel contents when project is default 2025-03-26 23:33:15 +01:00
13266d112c
ci: 23.1.0 2025-03-26 16:23:02 +01:00
74f1ceb880
chore: remove obsolete lang keys 2025-03-26 16:22:44 +01:00
af9ebee500
feat: Add support for ctrl+shift+f10 2025-03-26 16:22:42 +01:00
cc062b533e
feat: centralize direnv config 2025-03-26 16:20:25 +01:00
612841724c
ci: jbpublish do not depend on signPlugin 2025-03-23 15:02:31 +01:00
0cbce88d10
ci: next dev 2025-03-23 14:40:34 +01:00
1ce31d786d
ci: 23.0.2 2025-03-23 14:40:34 +01:00
8880f22840
ci: add push.sh 2025-03-23 14:40:33 +01:00
94fe15409a
chore: organize zig lexer 2025-03-23 14:40:33 +01:00
868c37c567
fix: improve comment and multiline string tokenizer 2025-03-23 14:35:21 +01:00
e33c96d658
chore: grammar tidy 2025-03-23 12:12:57 +01:00
f02f50c1a7
ci: next dev 2025-03-20 00:23:35 +01:00
9faa421ad9
ci: 23.0.1 2025-03-20 00:18:12 +01:00
009db1cb0f
chore: Optimize imports 2025-03-20 00:13:32 +01:00
5c682f6bfa
fix: EDT deadlocks 2025-03-20 00:10:31 +01:00
cc7d1393d6
fix: improved mkfifo/bash detection for ZIG_PROGRESS 2025-03-19 16:52:17 +01:00
7ee7e2f3d1
ci: next dev 2025-03-19 16:51:57 +01:00
f138a2a4ba
ci: 23.0.0 2025-03-15 16:46:05 +01:00
7c14ca2944
chore: zls version visualizer get rid of trailing newline 2025-03-15 16:41:06 +01:00
7c0fb4412d
feat: remove custom templates for now 2025-03-15 16:40:48 +01:00
cb4ecb9ff6
chore: remove string builder in IPC wrapper 2025-03-15 16:40:06 +01:00
7da3af7cd0
ci: bump lsp4ij dep 2025-03-15 16:39:42 +01:00
09ec2d79cc
feat: std.Progress support in debugging 2025-03-14 23:41:23 +01:00
2f8bc57fe1
feat!: Zig std.Progress support 2025-03-14 23:40:40 +01:00
b2d4355488
ci: next dev 2025-03-14 11:28:27 +01:00
1382aed48c
docs: update supporters list 2025-03-14 11:28:10 +01:00
404a554654
ci: 22.0.1 2025-03-13 23:06:34 +01:00
206cc1e437
fix: refactor ZLS restart logic 2025-03-13 23:04:08 +01:00
c6f3a8202b
fix: make workspace handler logic more error-resistant 2025-03-13 23:03:02 +01:00
4f9c324af1
fix: don't call modal progress if in write action in validateSync 2025-03-13 22:12:46 +01:00
a9b55ec830
ci: next dev 2025-03-13 16:44:20 +01:00
08a04aff2c
ci: 22.0.0 2025-03-13 16:30:41 +01:00
fbeb7985e4
docs: Add warning about breaking change 2025-03-13 16:30:08 +01:00
c6af369b1c
feat: Version indicator for zls 2025-03-13 16:29:54 +01:00
2ab3570d08
chore: Detected toolchain -> Detected zig 2025-03-13 16:27:58 +01:00
d4a1b69172
feat: Descriptive zig environment errors 2025-03-13 14:42:41 +01:00
91ee38e922
fix: Only split args when passing them to a cmdline, store them as fixed strings 2025-03-13 14:10:05 +01:00
05ff125c1d
feat!: LSP misconfiguration warning banner 2025-03-13 13:52:06 +01:00
03a86defb9
fix: do not directly depend on com.intellij.nativeDebug in the plugin xml 2025-03-13 13:09:44 +01:00
a1c952e019
ci: next dev 2025-03-11 14:30:02 +01:00
5399fbe2a9
chore: remove code of merit 2025-03-11 14:29:48 +01:00
f1bbe84c71
ci: 21.1.0 2025-03-11 14:08:48 +01:00
d80230cba5
feat: zon lsp integration 2025-03-11 14:07:59 +01:00
e2406b406c
feat!: zon lexer/parser rewrite 2025-03-11 14:07:44 +01:00
e177001020
ci: next dev 2025-03-11 02:01:56 +01:00
f57d78f8c3
ci: 21.0.0 2025-03-11 01:31:35 +01:00
683aa7fad1
chore: get rid of weird import 2025-03-11 01:22:50 +01:00
c31a78d547
chore: [NO BACKPORT] fix 25.1 deprecations 2025-03-11 00:43:06 +01:00
16fb4b57b7
feat: Integrate stdlib into workspace model 2025-03-10 23:59:07 +01:00
88df5b1426
feat: Improved missing toolchain resistance 2025-03-10 23:57:56 +01:00
6b8b82e710
fix: zig env IDE error 2025-03-10 22:07:31 +01:00
f26be52940
chore: refactor new project panel and zls settings 2025-03-10 21:23:50 +01:00
0982b3488d
chore: separate out lsp logic from core 2025-03-10 19:14:06 +01:00
0b22a4538b
chore: update copyright year 2025-02-06 01:17:00 +01:00
ec66112700
ci: next dev 2025-02-05 22:23:44 +01:00
8e9968b6f5
ci: 20.3.0 2025-02-05 22:23:29 +01:00
2730b88c18
chore: Fix some invalid xml warning 2025-02-05 22:22:02 +01:00
efdde4aad2
feat: Better default colors 2025-02-05 22:21:44 +01:00
2694b9e1c1
chore: Fix a couple deprecations/obsolete calls 2025-01-31 15:18:37 +01:00
aaa8885081
ci: next dev 2025-01-30 13:25:32 +01:00
353151c4c5
ci: 20.2.2 2025-01-30 13:25:11 +01:00
009c5fa5ed
fix: zig build run debugging double run 2025-01-30 13:24:33 +01:00
2e6db5ccd3
ci: next dev 2025-01-22 12:29:20 +01:00
26c4b26ae8
ci: 20.2.1 2025-01-22 12:28:34 +01:00
63d45b87b5
fix: correct comment EOF handling 2025-01-22 12:28:03 +01:00
9ed15e49cf
ci: next dev 2025-01-21 15:52:37 +01:00
df15261196
ci: 20.2.0 2025-01-21 15:48:16 +01:00
dcce9a8b28
feat: live templates 2025-01-21 15:47:48 +01:00
993930fa99
ci: bump lsp4ij version 2025-01-21 15:18:05 +01:00
ecf01829cf
chore: Fix kotlin style issues 2025-01-21 14:36:03 +01:00
87d30dfaa2
ci: update intellij gradle plugin 2025-01-21 14:34:57 +01:00
4990cb42f6
ci: update gradle 2025-01-21 14:05:38 +01:00
3a5daab063
ci: 20.1.3 2025-01-15 20:16:08 +01:00
0edcce333b
chore: update gitignore template 2025-01-15 20:06:20 +01:00
9135cc6dd6
fix: crash with remote projects 2025-01-15 20:05:11 +01:00
14c909d50e
ci: 20.1.2 2025-01-12 14:41:25 +01:00
aace0d316f
fix: non-terminating lexer rule 2025-01-12 14:41:22 +01:00
9d05a4c3d7
fix: optimize ZigSourceFileFilter further 2025-01-12 14:34:45 +01:00
a3143dbc0c
fix: replaced Path.exists() calls with File.toFile().exists() 2025-01-12 14:20:14 +01:00
adb8797051
ci: 20.1.1 2024-12-24 12:52:01 +01:00
ff75518aa8
fix: For loop params trailing comma
issue: #88
2024-12-24 12:51:12 +01:00
694acfc1d3
chore: Grammar tidy 2024-12-24 12:49:18 +01:00
6879cbf0e5
fix: unterminated string EOF softlock 2024-12-24 12:48:34 +01:00
77e72ea98d
ci: 20.1.0 2024-12-22 23:11:34 +01:00
8a988d5bfe
feat: zig quote matching 2024-12-22 23:10:52 +01:00
c652e1f05c
fix: zon string quote handler 2024-12-22 22:55:47 +01:00
91e8857ea9
ci: 20.0.4 2024-12-11 17:14:00 +01:00
990563d70a
fix: new zig file action icon and location 2024-12-11 17:13:32 +01:00
0636ba09f6
chore: Migrate action names to resource bundle 2024-11-28 13:42:25 +01:00
f9317ebe29
ci: 20.0.3 2024-11-28 13:28:39 +01:00
66d76b99a4
chore: small lang file cleanup 2024-11-28 13:25:05 +01:00
a32068ce23
fix: Save all documents freezing progress 2024-11-28 13:20:56 +01:00
93d8deeec8
ci: buildscript tidy 2024-11-28 13:17:18 +01:00
6a67748355
ci: 20.0.2 2024-11-11 12:17:22 +01:00
27160d6778
feat: Background toolchain autodetection 2024-11-11 12:15:28 +01:00
0ed6adff8d
feat: Tell the user where to set the toolchain 2024-11-11 12:14:22 +01:00
17dca6d419
fix: module builder not disposing properly 2024-11-11 12:14:10 +01:00
d3de75f950
fix: direnv should only run in trusted projects 2024-11-11 12:09:46 +01:00
f067ca647c
fix: character literal escape sequences and unicode 2024-11-11 09:56:50 +01:00
c9a3388c57
ci: 20.0.1 2024-11-09 12:01:28 +01:00
7ab0657fd4
fix: wrong color for struct fields 2024-11-09 12:00:50 +01:00
e6be5d7995
fix: typo in the test exec config 2024-11-09 11:56:48 +01:00
e45872a98b
fix: remove janky suspending lazy logic 2024-11-09 11:54:02 +01:00
24da7b413a
chore: ignore K2 compiler dir 2024-11-09 11:52:34 +01:00
fbdeb371f7
ci: unset untilBuild if blank 2024-11-07 17:57:54 +01:00
7120d095d1
ci: next dev 2024-11-07 17:57:54 +01:00
9994416282
chore: fix FUNDING.yml 2024-11-07 17:57:49 +01:00
5fa4ff72d1
ci: publishing fixes 2024-11-07 17:50:23 +01:00
5eca261831
ci: 20.0.0 2024-11-07 17:25:15 +01:00
768b8b29ff
chore: misc github additions 2024-11-07 17:25:14 +01:00
aeeb2ab946
ci: [NO BACKPORT] bump kotlin 2024-11-07 17:25:09 +01:00
28527cddb4
chore: [NO BACKPORT] Fix deprecations 2024-11-07 16:34:06 +01:00
f704b6c936
ci: [NO BACKPORT] bump to latest EAP 2024-11-07 16:29:00 +01:00
37 changed files with 300 additions and 69 deletions

View file

@ -152,6 +152,7 @@ Changelog structure reference:
- Project
- Occasional "AWT events are not allowed inside write action" error coming from LSP
- IllegalStateException coming from the standard library handler
## [22.0.0]
@ -194,6 +195,8 @@ This (and newer) versions of the plugin will automatically upgrade tasks from 21
### Added
- Zig
- Changing the zig standard library path in the project settings now properly updates the dependency
- ZLS
- All of the config options are now exposed in the GUI

View file

@ -6,8 +6,8 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
plugins {
kotlin("jvm") version "1.9.22" apply false
kotlin("plugin.serialization") version "1.9.22" apply false
kotlin("jvm") version "2.1.10" apply false
kotlin("plugin.serialization") version "2.1.10" apply false
id("org.jetbrains.intellij.platform") version "2.5.0"
id("org.jetbrains.changelog") version "2.2.1"
id("org.jetbrains.grammarkit") version "2022.3.2.2" apply false
@ -90,6 +90,7 @@ allprojects {
intellijPlatform {
defaultRepositories()
snapshots()
}
}
}

View file

@ -58,7 +58,8 @@ class ZigClionDebuggerDriverConfigurationProvider: ZigDebuggerDriverConfiguratio
return when(toolchain.debuggerKind) {
CPPDebugger.Kind.BUNDLED_GDB,
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

@ -211,7 +211,7 @@ abstract class DAPDriver<Server : IDebugProtocolServer, Client : IDebugProtocolC
val cli = installer.install()
val args = HashMap<String, Any>()
args["program"] = Util.toWinPath(cli.exePath)
args["cmd"] = cli.workDirectory.toString()
args["cmd"] = cli.workingDirectory.toString()
args["name"] = "CPP Debug"
args["type"] = "cppvsdbg"
args["request"] = "launch"
@ -954,7 +954,7 @@ abstract class DAPDriver<Server : IDebugProtocolServer, Client : IDebugProtocolC
cli.withCharset(Charsets.UTF_8)
val cwd = args.cwd?.ifBlank { null }?.toNioPathOrNull()
if (cwd != null) {
cli.withWorkDirectory(cwd.toFile())
cli.withWorkingDirectory(cwd)
}
val childProcess = ZigProcessHandler(cli)
this@DAPDriver.childProcess = childProcess

View file

@ -34,7 +34,7 @@ class ZigProfileStateBinary(environment: ExecutionEnvironment, configuration: Zi
override suspend fun getCommandLine(toolchain: ZigToolchain, debug: Boolean): GeneralCommandLine {
val cli = GeneralCommandLine()
val cfg = configuration
cfg.workingDirectory.path?.let { cli.withWorkDirectory(it.toFile()) }
cfg.workingDirectory.path?.let { cli.withWorkingDirectory(it) }
cli.withExePath(cfg.exePath.path?.pathString ?: throw ExecutionException(ZigDebugBundle.message("exception.missing-exe-path")))
cli.withCharset(Charsets.UTF_8)
cli.addParameters(cfg.args.args)

View file

@ -41,7 +41,7 @@ class ZigDebugEmitBinaryInstaller<ProfileState: ZigProfileState<*>>(
override fun install(): GeneralCommandLine {
val cfg = profileState.configuration
val cli = PtyCommandLine().withConsoleMode(false).withExePath(executableFile.absolutePath)
cfg.workingDirectory.path?.let { x -> cli.withWorkDirectory(x.toFile()) }
cfg.workingDirectory.path?.let { x -> cli.withWorkingDirectory(x) }
cli.addParameters(exeArgs)
cli.withCharset(Charsets.UTF_8)
cli.withRedirectErrorStream(true)

View file

@ -29,6 +29,7 @@ import com.intellij.openapi.options.SimpleConfigurable
import com.intellij.util.xmlb.XmlSerializerUtil
import com.intellij.xdebugger.settings.DebuggerSettingsCategory
import com.intellij.xdebugger.settings.XDebuggerSettings
import java.util.function.Supplier
class ZigDebuggerSettings: XDebuggerSettings<ZigDebuggerSettings>("Zig") {
var debuggerKind = DebuggerKind.default
@ -58,9 +59,10 @@ class ZigDebuggerSettings: XDebuggerSettings<ZigDebuggerSettings>("Zig") {
GENERAL_SETTINGS_ID,
ZigDebugBundle.message("settings.debugger.title"),
ZigDebuggerGeneralSettingsConfigurableUi::class.java,
) {
instance
}
Supplier {
instance
}
)
}
companion object {

View file

@ -29,12 +29,12 @@ import com.falsepattern.zigbrains.debugger.toolchain.ZigDebuggerToolchainService
import com.falsepattern.zigbrains.shared.coroutine.withCurrentEDTModalityContext
import com.intellij.notification.Notification
import com.intellij.notification.NotificationType
import com.intellij.openapi.progress.coroutineToIndicator
import com.intellij.openapi.ui.DialogBuilder
import com.intellij.platform.util.progress.withProgressText
import com.intellij.ui.components.JBLabel
import com.intellij.ui.components.JBPanel
import com.intellij.util.download.DownloadableFileService
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withTimeoutOrNull
@ -96,7 +96,7 @@ private suspend fun downloadMSVCProps(): Properties {
val downloader = service.createDownloader(listOf(desc), "Debugger metadata downloading")
val downloadDirectory = downloadPath().toFile()
val prop = Properties()
val downloadResults = runBlocking {
val downloadResults = coroutineToIndicator {
downloader.download(downloadDirectory)
}
for (result in downloadResults) {

View file

@ -30,7 +30,7 @@ import com.intellij.openapi.application.PathManager
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.progress.blockingContext
import com.intellij.openapi.progress.coroutineToIndicator
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.DialogBuilder
import com.intellij.openapi.util.SystemInfo
@ -222,7 +222,7 @@ class ZigDebuggerToolchainService {
val downloader = service.createDownloader(descriptions, "Debugger downloading")
val downloadDirectory = downloadPath().toFile()
val downloadResults = reporter.sizedStep(100) {
blockingContext {
coroutineToIndicator {
downloader.download(downloadDirectory)
}
}
@ -233,7 +233,7 @@ class ZigDebuggerToolchainService {
val propertyName = binaryToDownload.propertyName
val archiveFile = result.first
reporter.indeterminateStep {
blockingContext {
coroutineToIndicator {
Unarchiver.unarchive(archiveFile.toPath(), baseDir, binaryToDownload.prefix)
}
}

View file

@ -42,7 +42,7 @@ abstract class MSVCDriverConfiguration: DAPDebuggerDriverConfiguration() {
val cli = GeneralCommandLine()
cli.withExePath(path.pathString)
cli.addParameters("--interpreter=vscode", "--extconfigdir=%USERPROFILE%\\.cppvsdbg\\extensions")
cli.withWorkDirectory(path.parent.toFile())
cli.withWorkingDirectory(path.parent)
return cli
}

View file

@ -103,7 +103,7 @@ class DirenvService(val project: Project): SerializablePersistentStateComponent<
}
private suspend fun run(workDir: Path, vararg args: String): DirenvOutput {
val cli = GeneralCommandLine("direnv", *args).withWorkDirectory(workDir.toFile())
val cli = GeneralCommandLine("direnv", *args).withWorkingDirectory(workDir)
val (process, exitCode) = withProgressText("Running ${cli.commandLineString}") {
withContext(Dispatchers.IO) {

View file

@ -160,7 +160,6 @@ class WorkDirectoryConfigurable(@Transient override val serializedName: String)
class WorkDirectoryConfigModule(private val serializedName: String) : PathConfigModule<WorkDirectoryConfigurable>() {
private val field = textFieldWithBrowseButton(
null,
ZigBrainsBundle.message("dialog.title.working-directory"),
FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(ZigBrainsBundle.message("dialog.title.working-directory"))
).also { Disposer.register(this, it) }
@ -199,8 +198,7 @@ class FilePathConfigurable(
class FilePathConfigModule(private val serializedName: String, @Nls private val label: String) : PathConfigModule<FilePathConfigurable>() {
private val field = textFieldWithBrowseButton(
null,
null,
FileChooserDescriptorFactory.createSingleFileDescriptor(),
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor(),
)
override var stringValue by field::text

View file

@ -66,7 +66,7 @@ abstract class ZigProfileState<T: ZigExecConfig<T>> (
val cli = PtyCommandLine().withConsoleMode(false)
cli.withExePath(zigExePath.pathString)
workingDir.path?.let { cli.withWorkDirectory(it.toFile()) }
workingDir.path?.let { cli.withWorkingDirectory(it) }
cli.withCharset(Charsets.UTF_8)
cli.addParameters(configuration.buildCommandLineArgs(debug))
return configuration.patchCommandLine(cli)

View file

@ -68,7 +68,7 @@ class ZigModuleBuilder: ModuleBuilder() {
internal val peer = ZigProjectGeneratorPeer(true).also { Disposer.register(parent ?: return@also) {it.dispose()} }
override fun getComponent(): JComponent {
return peer.component.withBorder()
return peer.myComponent.withBorder()
}
override fun disposeUIResources() {

View file

@ -50,7 +50,7 @@ class ZigNewProjectWizard: LanguageGeneratorNewProjectWizard {
override fun setupUI(builder: Panel): Unit = with(builder) {
row {
cell(peer.component).align(AlignX.FILL)
cell(peer.myComponent).align(AlignX.FILL)
}
}

View file

@ -23,6 +23,7 @@
package com.falsepattern.zigbrains.project.newproject
import com.intellij.ide.util.projectWizard.SettingsStep
import com.intellij.openapi.ui.TextFieldWithBrowseButton
import com.intellij.openapi.ui.ValidationInfo
import com.intellij.platform.ProjectGeneratorPeer
import com.intellij.ui.dsl.builder.panel
@ -32,12 +33,13 @@ class ZigProjectGeneratorPeer(var handleGit: Boolean): ProjectGeneratorPeer<ZigP
val newProjectPanel by lazy {
ZigNewProjectPanel(handleGit)
}
private val myComponent: JComponent by lazy {
val myComponent: JComponent by lazy {
panel {
newProjectPanel.attach(this)
}
}
override fun getComponent(): JComponent {
override fun getComponent(myLocationField: TextFieldWithBrowseButton, checkValid: Runnable): JComponent {
return myComponent
}

View file

@ -0,0 +1,33 @@
/*
* This file is part of ZigBrains.
*
* Copyright (C) 2023-2025 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* ZigBrains is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* ZigBrains is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.zigbrains.project.stdlib
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.AdditionalLibraryRootsProvider
import com.intellij.openapi.roots.SyntheticLibrary
class ZigLibraryRootProvider: AdditionalLibraryRootsProvider() {
override fun getAdditionalProjectLibraries(project: Project): Collection<SyntheticLibrary> {
return setOf(ZigSyntheticLibrary(project))
}
}

View file

@ -0,0 +1,190 @@
/*
* This file is part of ZigBrains.
*
* Copyright (C) 2023-2025 FalsePattern
* All Rights Reserved
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* ZigBrains is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, only version 3 of the License.
*
* ZigBrains is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with ZigBrains. If not, see <https://www.gnu.org/licenses/>.
*/
package com.falsepattern.zigbrains.project.stdlib
import com.falsepattern.zigbrains.Icons
import com.falsepattern.zigbrains.project.toolchain.ZigToolchainService
import com.falsepattern.zigbrains.project.toolchain.base.ZigToolchain
import com.falsepattern.zigbrains.project.toolchain.local.LocalZigToolchain
import com.intellij.navigation.ItemPresentation
import com.intellij.openapi.project.Project
import com.intellij.openapi.project.guessProjectDir
import com.intellij.openapi.roots.SyntheticLibrary
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.vfs.refreshAndFindVirtualDirectory
import com.intellij.platform.backend.workspace.WorkspaceModel
import com.intellij.platform.backend.workspace.toVirtualFileUrl
import com.intellij.platform.workspace.jps.entities.*
import com.intellij.project.isDirectoryBased
import com.intellij.project.stateStore
import com.intellij.workspaceModel.ide.legacyBridge.LegacyBridgeJpsEntitySourceFactory
import kotlinx.coroutines.runBlocking
import java.util.*
import javax.swing.Icon
class ZigSyntheticLibrary(val project: Project) : SyntheticLibrary(), ItemPresentation {
private var toolchain: ZigToolchain? = ZigToolchainService.getInstance(project).toolchain
private val roots by lazy {
runBlocking {getRoot(toolchain, project)}?.let { setOf(it) } ?: emptySet()
}
private val name by lazy {
getName(toolchain, project)
}
override fun equals(other: Any?): Boolean {
if (other !is ZigSyntheticLibrary)
return false
return toolchain == other.toolchain
}
override fun hashCode(): Int {
return Objects.hash(roots)
}
override fun getPresentableText(): String {
return name
}
override fun getIcon(unused: Boolean): Icon {
return Icons.Zig
}
override fun getSourceRoots(): Collection<VirtualFile> {
return roots
}
override fun isShowInExternalLibrariesNode(): Boolean {
return !roots.isEmpty()
}
companion object {
private const val ZIG_LIBRARY_ID = "Zig SDK"
private const val ZIG_MODULE_ID = "ZigBrains"
private val libraryTableId = LibraryTableId.ProjectLibraryTableId
private val libraryId = LibraryId(ZIG_LIBRARY_ID, libraryTableId)
private val moduleId = ModuleId(ZIG_MODULE_ID)
suspend fun reload(project: Project, toolchain: ZigToolchain?) {
val root = getRoot(toolchain, project)
if (root != null) {
add(project, root)
} else {
remove(project)
}
}
private suspend fun remove(project: Project) {
val workspaceModel = WorkspaceModel.getInstance(project)
workspaceModel.update("Update Zig std") { builder ->
builder.resolve(moduleId)?.let { moduleEntity ->
builder.removeEntity(moduleEntity)
}
builder.resolve(libraryId)?.let { libraryEntity ->
builder.removeEntity(libraryEntity)
}
}
}
private suspend fun add(project: Project, root: VirtualFile) {
val workspaceModel = WorkspaceModel.getInstance(project)
val libRoot = LibraryRoot(root.toVirtualFileUrl(workspaceModel.getVirtualFileUrlManager()), LibraryRootTypeId.SOURCES)
var baseModuleDirFile: VirtualFile? = null
if (project.isDirectoryBased) {
baseModuleDirFile = project.stateStore.directoryStorePath?.refreshAndFindVirtualDirectory()
}
if (baseModuleDirFile == null) {
baseModuleDirFile = project.guessProjectDir()
}
val baseModuleDir = baseModuleDirFile?.toVirtualFileUrl(workspaceModel.getVirtualFileUrlManager()) ?: return
workspaceModel.update("Update Zig std") { builder ->
builder.resolve(moduleId)?.let { moduleEntity ->
builder.removeEntity(moduleEntity)
}
val moduleEntitySource = LegacyBridgeJpsEntitySourceFactory.getInstance(project)
.createEntitySourceForModule(baseModuleDir, null)
val moduleEntity = builder.addEntity(ModuleEntity(ZIG_MODULE_ID, emptyList(), moduleEntitySource))
builder.resolve(libraryId)?.let { libraryEntity ->
builder.removeEntity(libraryEntity)
}
val libraryEntitySource = LegacyBridgeJpsEntitySourceFactory
.getInstance(project)
.createEntitySourceForProjectLibrary(null)
val libraryEntity = LibraryEntity(
ZIG_LIBRARY_ID,
libraryTableId, emptyList(),
libraryEntitySource
) {
roots.add(libRoot)
}
builder.addEntity(libraryEntity)
builder.modifyModuleEntity(moduleEntity) {
val dep = LibraryDependency(libraryId, false, DependencyScope.COMPILE)
dependencies.clear()
dependencies.add(dep)
}
}
}
}
}
private fun getName(
toolchain: ZigToolchain?,
project: Project
): String {
val tc = toolchain ?: return "Zig"
toolchain.name?.let { return it }
runBlocking { tc.zig.getEnv(project) }
.mapCatching { it.version }
.getOrNull()
?.let { return "Zig $it" }
return "Zig"
}
suspend fun getRoot(
toolchain: ZigToolchain?,
project: Project
): VirtualFile? {
//TODO universal
if (toolchain !is LocalZigToolchain) {
return null
}
if (toolchain.std != null) run {
val ePath = toolchain.std
if (ePath.isAbsolute) {
val roots = ePath.refreshAndFindVirtualDirectory() ?: return@run
return roots
}
val stdPath = toolchain.location.resolve(ePath)
if (stdPath.isAbsolute) {
val roots = stdPath.refreshAndFindVirtualDirectory() ?: return@run
return roots
}
}
val stdPath = toolchain.zig.getEnv(project).mapCatching { it.stdPath(toolchain, project) }.getOrNull() ?: return null
val roots = stdPath.refreshAndFindVirtualDirectory() ?: return null
return roots
}

View file

@ -22,11 +22,16 @@
package com.falsepattern.zigbrains.project.toolchain
import com.falsepattern.zigbrains.project.stdlib.ZigSyntheticLibrary
import com.falsepattern.zigbrains.project.toolchain.base.ZigToolchain
import com.falsepattern.zigbrains.shared.asUUID
import com.falsepattern.zigbrains.shared.zigCoroutineScope
import com.intellij.openapi.application.EDT
import com.intellij.openapi.components.*
import com.intellij.openapi.project.Project
import com.intellij.util.xmlb.annotations.Attribute
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.util.*
@Service(Service.Level.PROJECT)
@ -50,6 +55,9 @@ class ZigToolchainService(private val project: Project): SerializablePersistentS
updateState {
it.copy(toolchain = value?.toString() ?: "")
}
zigCoroutineScope.launch(Dispatchers.EDT) {
ZigSyntheticLibrary.reload(project, toolchain)
}
}
val toolchain: ZigToolchain?

View file

@ -56,7 +56,7 @@ class LocalToolchainSelector(component: Component): LocalSelector<LocalZigToolch
} else {
val existingToolchain = zigToolchainList
.mapNotNull { it.second as? LocalZigToolchain }
.firstOrNull { it.location == tc!!.location }
.firstOrNull { it.location == tc.location }
if (existingToolchain != null) {
result = VerifyResult(
null,

View file

@ -27,7 +27,7 @@ import com.falsepattern.zigbrains.shared.downloader.VersionInfo
import com.falsepattern.zigbrains.shared.downloader.VersionInfo.Tarball
import com.falsepattern.zigbrains.shared.downloader.getTarballIfCompatible
import com.falsepattern.zigbrains.shared.downloader.tempPluginDir
import com.intellij.openapi.progress.blockingContext
import com.intellij.openapi.progress.coroutineToIndicator
import com.intellij.openapi.util.io.FileUtil
import com.intellij.util.asSafely
import com.intellij.util.download.DownloadableFileService
@ -54,7 +54,7 @@ data class ZigVersionInfo(
val tempFile = FileUtil.createTempFile(tempPluginDir, "index", ".json", false, false)
val desc = service.createFileDescription("https://ziglang.org/download/index.json", tempFile.name)
val downloader = service.createDownloader(listOf(desc), ZigBrainsBundle.message("settings.toolchain.downloader.service.index"))
val downloadResults = blockingContext {
val downloadResults = coroutineToIndicator {
downloader.download(tempPluginDir)
}
if (downloadResults.isEmpty())

View file

@ -47,8 +47,7 @@ import kotlin.io.path.pathString
class LocalZigToolchainPanel() : ImmutableNamedElementPanelBase<LocalZigToolchain>() {
private val pathToToolchain = textFieldWithBrowseButton(
null,
ZigBrainsBundle.message("dialog.title.zig-toolchain"),
FileChooserDescriptorFactory.createSingleFolderDescriptor()
FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(ZigBrainsBundle.message("dialog.title.zig-toolchain"))
).also {
it.textField.document.addDocumentListener(object : DocumentAdapter() {
override fun textChanged(e: DocumentEvent) {
@ -70,8 +69,7 @@ class LocalZigToolchainPanel() : ImmutableNamedElementPanelBase<LocalZigToolchai
}
private val pathToStd = textFieldWithBrowseButton(
null,
ZigBrainsBundle.message("dialog.title.zig-std"),
FileChooserDescriptorFactory.createSingleFolderDescriptor()
FileChooserDescriptorFactory.createSingleFolderDescriptor().withTitle(ZigBrainsBundle.message("dialog.title.zig-std"))
).also { Disposer.register(this, it) }
private var debounce: Job? = null

View file

@ -31,7 +31,6 @@ import com.intellij.icons.AllIcons
import com.intellij.openapi.project.Project
import com.intellij.ui.SimpleTextAttributes
import com.intellij.ui.icons.EMPTY_ICON
import com.intellij.util.ui.EmptyIcon
import javax.swing.JList
class TCComboBox(model: ZBModel<ZigToolchain>): ZBComboBox<ZigToolchain>(model, ::TCCellRenderer)
@ -68,7 +67,7 @@ class TCCellRenderer(getModel: () -> ZBModel<ZigToolchain>): ZBCellRenderer<ZigT
append(ZigBrainsBundle.message("settings.toolchain.model.from-disk.text"))
}
is ListElem.Pending -> {
icon = EMPTY_ICON
icon = AllIcons.Empty
append(ZigBrainsBundle.message("settings.toolchain.model.loading.text"), SimpleTextAttributes.GRAYED_ATTRIBUTES)
}
is ListElem.None, null -> {
@ -78,5 +77,4 @@ class TCCellRenderer(getModel: () -> ZBModel<ZigToolchain>): ZBCellRenderer<ZigT
}
}
}
private val EMPTY_ICON = EmptyIcon.create(16, 16)
}

View file

@ -123,7 +123,7 @@ fun createCommandLineSafe(
return Result.failure(IllegalArgumentException("file is a directory: ${exe.pathString}"))
val cli = GeneralCommandLine()
.withExePath(exe.toString())
.withWorkDirectory(workingDirectory?.toFile())
.withWorkingDirectory(workingDirectory)
.withParameters(*parameters)
.withCharset(Charsets.UTF_8)
return Result.success(cli)

View file

@ -33,7 +33,7 @@ import kotlinx.coroutines.*
import java.awt.Component
import kotlin.coroutines.CoroutineContext
inline fun <T> runModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleFactory: () -> String, cancellationFactory: () -> TaskCancellation = TaskCancellation::cancellable, noinline action: suspend CoroutineScope.() -> T): T {
inline fun <T> runModalOrBlocking(taskOwnerFactory: () -> ModalTaskOwner, titleFactory: () -> String, cancellationFactory: () -> TaskCancellation = {TaskCancellation.cancellable()}, noinline action: suspend CoroutineScope.() -> T): T {
return if (application.isDispatchThread) {
runWithModalProgressBlocking(taskOwnerFactory(), titleFactory(), cancellationFactory(), action)
} else {

View file

@ -96,7 +96,7 @@ abstract class Downloader<T, V: VersionInfo>(val component: Component) {
value?.let { append(it.version.rawVersion) }
}
}
val outputPath = textFieldWithBrowseButton(null, selector.descriptor.title, selector.descriptor)
val outputPath = textFieldWithBrowseButton(null, selector.descriptor)
Disposer.register(dialog, outputPath)
outputPath.textField.columns = 50

View file

@ -66,7 +66,7 @@ abstract class LocalSelector<T>(val component: Component) {
private suspend fun doBrowseFromDisk(preSelected: Path?): T? {
val dialog = DialogBuilder()
val name = JBTextField().also { it.columns = 25 }
val path = textFieldWithBrowseButton(null, descriptor.title, descriptor)
val path = textFieldWithBrowseButton(null, descriptor)
Disposer.register(dialog, path)
lateinit var errorMessageBox: JBLabel
suspend fun verifyAndUpdate(path: Path?) {

View file

@ -28,7 +28,7 @@ import com.falsepattern.zigbrains.shared.downloader.VersionInfo.Tarball
import com.intellij.openapi.application.PathManager
import com.intellij.openapi.progress.EmptyProgressIndicator
import com.intellij.openapi.progress.ProgressManager
import com.intellij.openapi.progress.blockingContext
import com.intellij.openapi.progress.coroutineToIndicator
import com.intellij.openapi.util.io.FileUtil
import com.intellij.openapi.util.io.toNioPathOrNull
import com.intellij.platform.util.progress.ProgressReporter
@ -83,7 +83,7 @@ suspend fun downloadTarball(dist: Tarball, into: Path, reporter: ProgressReporte
val desc = service.createFileDescription(dist.tarball, tempFile.name)
val downloader = service.createDownloader(listOf(desc), ZigBrainsBundle.message("settings.toolchain.downloader.service.tarball"))
val downloadResults = reporter.sizedStep(100) {
blockingContext {
coroutineToIndicator {
downloader.download(into.toFile())
}
}
@ -99,7 +99,7 @@ suspend fun flattenDownloadDir(dir: Path, reporter: ProgressReporter) {
if (contents.size == 1 && contents[0].isDirectory()) {
val src = contents[0]
reporter.indeterminateStep {
blockingContext {
coroutineToIndicator {
val indicator = ProgressManager.getInstance().progressIndicator ?: EmptyProgressIndicator()
indicator.isIndeterminate = true
indicator.text = ZigBrainsBundle.message("settings.toolchain.downloader.progress.flatten")
@ -121,7 +121,7 @@ suspend fun unpackTarball(tarball: Path, into: Path, reporter: ProgressReporter)
withContext(Dispatchers.IO) {
try {
reporter.indeterminateStep {
blockingContext {
coroutineToIndicator {
Unarchiver.unarchive(tarball, into)
}
}

View file

@ -87,7 +87,7 @@ abstract class UUIDMapSelector<T>(val driver: UUIDComboBoxDriver<T>): Disposable
val actual = item is ListElem.One.Actual<*>
editButton?.isEnabled = actual
editButton?.repaint()
onSelection(if (actual) (item as ListElem.One.Actual<*>).uuid else null)
onSelection(if (actual) item.uuid else null)
}
private fun itemStateChanged(event: ItemEvent) {

View file

@ -76,13 +76,9 @@ private fun <T : PsiElement> ZigMultilineAssistant<T>.preprocessEnter(
val indentPost = parts[1].measureSpaces()
val newLine = StringBuilder(1 + indentPre + prefix.length + indentPost)
.append('\n')
for (i in 0..<indentPre) {
newLine.append(' ')
}
newLine.append(prefix)
for (i in 0..<indentPost) {
newLine.append(' ')
}
.repeat(' '.code, indentPre)
.append(prefix)
.repeat(' '.code, indentPost)
document.insertString(offset, newLine)
PsiDocumentManager.getInstance(project).commitDocument(document)
editor.caretModel.moveToOffset(offset + newLine.length)

View file

@ -165,6 +165,10 @@
implementation="com.falsepattern.zigbrains.project.console.ZigSourceFileFilter"
/>
<additionalLibraryRootsProvider
implementation="com.falsepattern.zigbrains.project.stdlib.ZigLibraryRootProvider"
/>
<!--suppress PluginXmlValidity -->
<toolWindow
factoryClass="com.falsepattern.zigbrains.project.steps.ui.BuildToolWindowFactory"

View file

@ -3,13 +3,13 @@ pluginRepositoryUrl=https://github.com/FalsePattern/ZigBrains
pluginVersion=25.2.0
pluginSinceBuild=241
pluginUntilBuild=241.*
pluginSinceBuild=251
pluginUntilBuild=
ideaCommunityVersion=2024.1.7
clionVersion=2024.1.6
ideaCommunityVersion=2025.1
clionVersion=2025.1
useInstaller=true
javaVersion=17
javaVersion=21
# ideaCommunity / clion
runIdeTarget=clion
@ -17,7 +17,7 @@ lsp4jVersion=0.21.1
lsp4ijVersion=0.12.0
lsp4ijNightly=false
serializationVersion=1.6.3
serializationVersion=1.7.3
kotlin.stdlib.default.dependency=false
kotlin.code.style=official

View file

@ -46,7 +46,7 @@ class ZLSStreamConnectionProvider private constructor(private val project: Proje
companion object {
suspend fun create(project: Project): ZLSStreamConnectionProvider {
val projectDir = project.guessProjectDir()?.toNioPathOrNull()
val commandLine = getCommand(project)?.let { GeneralCommandLine(it) }?.withWorkDirectory(projectDir?.toFile())
val commandLine = getCommand(project)?.let { GeneralCommandLine(it) }?.withWorkingDirectory(projectDir)
return ZLSStreamConnectionProvider(project, commandLine)
}

View file

@ -43,8 +43,8 @@ import javax.swing.text.PlainDocument
class ZLSSettingsPanel() : ImmutableElementPanel<ZLSSettings> {
private val zlsConfigPath = textFieldWithBrowseButton(
null,
ZLSBundle.message("settings.zls-config-path.browse.title"),
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
.withTitle(ZLSBundle.message("settings.zls-config-path.browse.title"))
).also { Disposer.register(this, it) }
private val inlayHints = JBCheckBox()
private val inlayHintsMaxFileSize = ExtendableTextField(5).also { (it.document as PlainDocument).documentFilter = object: DocumentFilter() {

View file

@ -49,8 +49,7 @@ import kotlin.io.path.pathString
class ZLSPanel() : ImmutableNamedElementPanelBase<ZLSVersion>() {
private val pathToZLS = textFieldWithBrowseButton(
null,
ZLSBundle.message("dialog.title.zls"),
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor()
FileChooserDescriptorFactory.createSingleFileNoJarsDescriptor().withTitle(ZLSBundle.message("dialog.title.zls"))
).also {
it.textField.document.addDocumentListener(object : DocumentAdapter() {
override fun textChanged(e: DocumentEvent) {

View file

@ -28,7 +28,7 @@ import com.falsepattern.zigbrains.shared.downloader.VersionInfo
import com.falsepattern.zigbrains.shared.downloader.VersionInfo.Tarball
import com.falsepattern.zigbrains.shared.downloader.getTarballIfCompatible
import com.falsepattern.zigbrains.shared.downloader.tempPluginDir
import com.intellij.openapi.progress.blockingContext
import com.intellij.openapi.progress.coroutineToIndicator
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.io.FileUtil
import com.intellij.util.asSafely
@ -52,7 +52,7 @@ data class ZLSVersionInfo(
return withContext(Dispatchers.IO) {
val single = toolchain != null
val url = if (single) {
getToolchainURL(toolchain!!, project) ?: return@withContext emptyList()
getToolchainURL(toolchain, project) ?: return@withContext emptyList()
} else {
multiURL
}
@ -60,7 +60,7 @@ data class ZLSVersionInfo(
val tempFile = FileUtil.createTempFile(tempPluginDir, "zls_version_info", ".json", false, false)
val desc = service.createFileDescription(url, tempFile.name)
val downloader = service.createDownloader(listOf(desc), ZLSBundle.message("settings.downloader.service.index"))
val downloadResults = blockingContext {
val downloadResults = coroutineToIndicator {
downloader.download(tempPluginDir)
}
if (downloadResults.isEmpty())

View file

@ -30,7 +30,6 @@ import com.intellij.icons.AllIcons
import com.intellij.openapi.project.Project
import com.intellij.ui.SimpleTextAttributes
import com.intellij.ui.icons.EMPTY_ICON
import com.intellij.util.ui.EmptyIcon
import javax.swing.JList
import kotlin.io.path.pathString
@ -71,7 +70,7 @@ class ZLSCellRenderer(getModel: () -> ZBModel<ZLSVersion>): ZBCellRenderer<ZLSVe
append(ZLSBundle.message("settings.model.from-disk.text"))
}
is ListElem.Pending -> {
icon = EMPTY_ICON
icon = AllIcons.Empty
append(ZLSBundle.message("settings.model.loading.text"), SimpleTextAttributes.GRAYED_ATTRIBUTES)
}
is ListElem.None, null -> {
@ -81,5 +80,4 @@ class ZLSCellRenderer(getModel: () -> ZBModel<ZLSVersion>): ZBCellRenderer<ZLSVe
}
}
}
private val EMPTY_ICON = EmptyIcon.create(16, 16)
}