-
-
Notifications
You must be signed in to change notification settings - Fork 407
Expand conditional types in hover popup #2349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c4afad2 to
27b74cb
Compare
Techatrix
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Uh oh!
There was an error while loading. Please reload this page.