FalsePattern / ZigBrains

The zig language plugin for intellij
https://plugins.jetbrains.com/plugin/22456-zigbrains
Other
103 stars 7 forks source link

Debugging on Windows Does Not Work with MSVC Installed #54

Open Elephant1214 opened 1 month ago

Elephant1214 commented 1 month ago

I recently installed ZigBrains and noticed that completion did not work for external libraries. When I looked around for answers, I saw the instructions for setting up the debugger, but I already had MSVC installed. There's no option to set a path to it and the download button does nothing and the "Download and update the debugger automatically" button just bricks the IDE when I open a Zig project. I am using IntelliJ IDEA Ultimate 2024.1.4 and ZigBrains 15.2.0-241.

Elephant1214 commented 1 month ago

A more detailed description of what is happening is in the latest comments on #37

FalsePattern commented 1 month ago

The server endpoint that ZigBrains was trying to fetch the debugger metadata from was not functioning correctly, the downloading should be fixed now.

FalsePattern commented 1 month ago

I'll also add a fallback system to 16.0.0 so that it still works even if that server is down

Elephant1214 commented 1 month ago

Updated to the latest 2024.1.* beta and now the update button works, but I can't open zig files at all.

FalsePattern commented 1 month ago

Updated to the latest 2024.1.* beta and now the update button works, but I can't open zig files at all.

you can try installing the nightly version of ZigBrains by:

  1. Adding the zigbrains updater URL to your custom plugin repositories (see: https://github.com/FalsePattern/ZigBrains?tab=readme-ov-file#installing)
  2. Adding the lsp4ij nightlies updater URL to your custom plugin repositories(same way, URL: https://plugins.jetbrains.com/plugins/nightly/23257)
  3. Restart the IDE, and you should be able to download ZB 16.0.0-pre2
Elephant1214 commented 1 month ago

I already had 16.0.0-pre2-241, I updated LSP4IJ to 0.3.0-20240718-013045. The ZLS status icon is missing no matter what I do and ZLS appears to work occasionally.

FalsePattern commented 1 month ago

The ZLS status icon is no longer a thing, the language server connection is now managed by LSP4IJ in ZigBrains 16.0.0: https://github.com/redhat-developer/lsp4ij

FalsePattern commented 1 month ago

Is MSVC debugging still not working in the latest 16.x releases?

Elephant1214 commented 1 month ago

No, it's not. It sometimes freezes, which is fine, but it still can't find anything from external libraries and can sometimes take a while to update things like errors.

mattrudder commented 1 month ago

Came to post about a similar issue, not sure if this is exactly what OP is seeing though...

I've been using the plugin on Windows including debugging for about a week straight very consistently (great work!), but last night I started seeing hangs when launching the debugger, with the following in the Notifications timeline in version 16.1.2-242:

Debugger metadata downloading failed
Debugger fallback metadata fetch failed

Looking through the code for the error, it seems like the plugin is likely timing out trying to download the debugger metadata from https://falsepattern.com/zigbrains/msvc.properties, which is currently returning 504 Gateway Timeout errors. FWIW, I have the "Download and update the debugger automatically" option disabled,with "Use Clion toolchains instead" selected, so its not clear why the plugin is attempting to download anything. Seems like it's effectively doing a version check on each launch, is that accurate?

IMO, it would be a nice feature to have an opt-out or override to only rely on the local filesystem / embedded resources. The download request currently takes about a minute by default to timeout before the current fallback code executes, which for some reason doesn't appear to be working either in my version.

I'd be interested to figure out how to contribute this myself if it's welcome, but I've got a bit of a learning curve before I could be productive in the codebase I think. 😅

As a workaround, I've lowered the HTTP timeout thresholds for IntelliJ via Help > Edit Custom VM Options... to make the hang a little less impactful until there's an alternative:

-Didea.connection.timeout=1000
-Didea.read.timeout=1000
FalsePattern commented 1 month ago

I'll add an override for the version check in the next update (and decrease the timeout too), sorry about the inconvenience. The hosting provider I use for my website seems to be having issues lately.

FalsePattern commented 1 month ago

It should be fixed properly in 16.1.3. I've added the metadata download consent prompt, and I also made it cache the metadata, so it will only download it once per IDE launch.

The fallback metadata parsing has also been fixed, i accidentally had a typo in the resource path.

mattrudder commented 1 month ago

Incredible, thanks for the quick action on this!