Expand conditional types in hover popup#2349
Merged
Merged
Conversation
c4afad2 to
27b74cb
Compare
Techatrix
requested changes
Jun 7, 2025
Techatrix
left a comment
Member
There was a problem hiding this comment.
const foo = if (true) 1 else true;
const bar = if (true)
.{ foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo }
else
.{ foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo, foo };Hovering over bar will cause ZLS to consume huge amounts of memory. Not sure when it stops but it's at least 10GB.
a438dfc to
d8be34f
Compare
Techatrix
requested changes
Jun 23, 2025
Techatrix
left a comment
Member
There was a problem hiding this comment.
const a = if (true) 1 else true;
const b = if (true) false else 0;
const c = if (true) .{ a, b } else .{ b, a };
const d = if (true) .{ a, c } else .{ b, c };
const e = if (true) .{ c, d } else .{ d, c };
const f = if (true) .{ d, e } else .{ e, d };
const g = if (true) .{ e, f } else .{ f, e };
const h = if (true) .{ f, g } else .{ g, f };Hovering over h will hang. Limiting the total number of combinations that will be analyzed should be a simple solution to this.
Techatrix
requested changes
Jun 24, 2025
Techatrix
left a comment
Member
There was a problem hiding this comment.
There shouldn't be a config option for this. We can pick a limit that is high enough to not affect users with real code but low enough to prevent hand crafted examples like mine. There is no point in giving users choices they shouldn't need to make.
For testing, the option in analysis.zig can remain with a default value. The specific tests can then override it if needed.
Set the maximum to 200 since VS Code's hover popup seems to be limited to ~220 lines anyways.
Techatrix
approved these changes
Jun 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.