New VS Code Extension Replaces Booleans with Toggles

3 years ago by sebastiancarlos to c/programmerhumor

conciselyverbose 38 points 3 years ago

I, uh, actually kind of like the idea. If you just visually converted primitives to a toggle after you type true/false, and let you delete it like any other text, it could be a small convenience on any flags you might change during the development process.

path: 0 410052, hotness: undefined, score: 38, children: 8
Perry 7 points 3 years ago

As long as it's not literally a toggle that you can interact with.

I can only imagine the horrors of accidentally clicking in the editor while selecting some text and quietly changing certificateIsValid = false; to true or something like that.

path: 0 410052 410908, hotness: undefined, score: 7, children: 2
Maven 9 points 3 years ago

Nah, make it a keybind like alt-shift-click and give it a deafening sound like throwing an industrial breaker.

path: 0 410052 410908 422291, hotness: undefined, score: 9, children: 0
justinalanbass 1 point 3 years ago

I guess it would show up in git. But yea this sounds like the new "typing my password in the tema chat".

path: 0 410052 410908 421538, hotness: undefined, score: 1, children: 0
PlexSheep 6 points 3 years ago

As a visual indicator, sure.

path: 0 410052 410053, hotness: undefined, score: 6, children: 3
conciselyverbose 11 points 3 years ago

Oh, I could easily see a trainwreck of an implementation. But if this was just a display option like color coding keywords and variables, but you could click to change the underlying true/false? I might add it.

path: 0 410052 410053 410400, hotness: undefined, score: 11, children: 2
sebastiancarlos 8 points 3 years ago path: 0 410052 410053 410400 410657, hotness: undefined, score: 8, children: 1
LukeChriswalker 3 points 3 years ago

Beatiful. Magnificent indeed

To actual posisble implementations, it'd actually be interesting as an indicator next to the bool to make it easier to see when debugging

path: 0 410052 410053 410400 410657 465554, hotness: undefined, score: 3, children: 0
sebastiancarlos 4 points 3 years ago

I mean this as a joke but you might be right. A quick search suggests that no one implemented something like this yet.

path: 0 410052 413941, hotness: undefined, score: 4, children: 0
fibojoly 20 points 3 years ago

I can't tell if it's a parody or an actual genius idea.

path: 0 449422, hotness: undefined, score: 20, children: 5
GlitchyDigiBun 3 points 3 years ago

I would like to see the debugger give a list of all these boolean values and watch them toggle in real time. That would be far more useful.

path: 0 449422 471410, hotness: undefined, score: 3, children: 3
sebastiancarlos 4 points 3 years ago

fwiw I opened an issue on the vs code repo. It already got a downvote and the issue was reassigned from one maintainer to another. Popcorn is tightly secured.

path: 0 449422 471410 471467, hotness: undefined, score: 4, children: 2
GlitchyDigiBun 2 points 3 years ago

Eh, I'll stick with C# slowly becoming more and more syntax-redundant like all the other OOPLs :'(

path: 0 449422 471410 471467 472065, hotness: undefined, score: 2, children: 0
Korne127 1 point 3 years ago

Oh my god, this is amazing!

path: 0 449422 471410 471467 472669, hotness: undefined, score: 1, children: 0
dingdong 1 point 2 years ago

No there is AT LEAST one use for this. You could create an options class with booleans, and you could toggle settings when running or debugging. Also less savvy people (other non software engineers) can toggle settings easier for internal tools.

path: 0 449422 13239390, hotness: undefined, score: 1, children: 0
Henrik 19 points 3 years ago

Previously I was able to search for “true” and “false” in my codebase. How do I do that now? VS Code has a new search interface specifically for toggles. It’s closed by default, but you can open it by clicking the “Toggle Search Toggle” toggle.

Yo dawg, I heard you liked toggles so we gave you a toggle to search for toggles in your toggle

Also, the section defining behaviour for null and undefined values are kind of bonkers.

Buuut, a nice visual nonetheless. I don't see myself using it though.

path: 0 423792, hotness: undefined, score: 19, children: 0
MegaUmbreon 11 points 3 years ago

Ngl I dont hate it.

path: 0 423497, hotness: undefined, score: 11, children: 0
Jorgelhus 11 points 3 years ago

You know, I could find a few cases where this could have helped me troubleshoot stuff on the code.

path: 0 410824, hotness: undefined, score: 11, children: 0
JSens1998 9 points 3 years ago

It looks neat, but I think I'll keep my true and false. I don't like chhannngggeeee!

path: 0 464272, hotness: undefined, score: 9, children: 0
justinalanbass 8 points 3 years ago

Grep -Irn "green toggle thingy" ./*

path: 0 421488, hotness: undefined, score: 8, children: 0
kubica 4 points 3 years ago

Sounds like some condiment for the spaghetti.

path: 0 411776, hotness: undefined, score: 4, children: 0
Hazzard 3 points 3 years ago

I used an extension a while ago that changed CSS colour values (#ababab) into little coloured dots, that became a colour picker when clicking on them (while still letting you input RGB or Hex, ofc), and it was pretty awesome!

So, I could unironically see this being really nice. Although... I think this would need a pretty narrow context, something like if x == true would look pretty confusing as a toggle, I imagine. But assigning x = true? Bring it on.

path: 0 476720, hotness: undefined, score: 3, children: 1
sebastiancarlos 7 points 3 years ago

Good point. I actually thing that having if x == true is bad practice anyway because it's redundant, so showing a toggle in that context would have the benefit of highlighting that something's wrong.

path: 0 476720 480585, hotness: undefined, score: 7, children: 0
CookieJarObserver 3 points 3 years ago
path: 0 414548, hotness: undefined, score: 3, children: 0
TechieDamien 1 point 3 years ago

MATLAB does this...

path: 0 440714, hotness: undefined, score: 1, children: 0
programmerhumor
programmerhumor

@lemmy.ml

login for more options
43801
1628
1576

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

go to feed...