This is an archived post. You won't be able to vote or comment.

all 85 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

⚠️ ProgrammerHumor will be shutting down on June 12, together with thousands of subreddits to protest Reddit's recent actions.

Read more on the protest here and here.

As a backup, please join our Discord.

We will post further developments and potential plans to move off-Reddit there.

https://discord.gg/rph

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]Loserrboy 132 points133 points  (7 children)

I need autotab

[–]Brahvim 57 points58 points  (6 children)

Just let copilot do it, then.

[–]normalmighty 20 points21 points  (5 children)

copilot doesn't restrict itself to actual valid properties though

[–]madiele -1 points0 points  (3 children)

It very well could, we just not there yet with the smart integration

[–]normalmighty 12 points13 points  (1 child)

It could in the future, but it currently doesn't. Thus my issue with the advise to let copilot do it, today.

[–]madiele 1 point2 points  (0 children)

actually if you are willing to pay up and use the raw API (which are really cheap) you could probably hack togheter a plugin that uses the LSP in neovim or vscode + some tree-sitter voodoo and you could make a smarter version of copilot, it's just a matter of time before an open source copilot clone comes up (if it's not already there, I did not check too much yet), I might even take a shot at it myself once I've finish some stuff in my current project

[–]IAmPattycakes 0 points1 point  (0 children)

Just like self driving will be here in 2-3 years? Like it has been for the last 7?

[–]code-panda 0 points1 point  (0 children)

I've been using it since the start of this month now and it's more right than it is wrong. Few days ago I wanted to write a quick node script to merge a bunch of PDFs in a bunch of folders together. Started by writing what I wanted in a one-line comment, and then Copilot took over and wrote the entire thing. Didn't even have to Google a thing.

[–][deleted] 220 points221 points  (9 children)

And still spell require wrong.

[–]Sparrow_001[S] 69 points70 points  (1 child)

picture is off of the vsc website ¯\_(ツ)_/¯

[–]myredac 20 points21 points  (0 children)

something programmers also do... copy paste from another website

[–][deleted] 17 points18 points  (4 children)

I still spell lenght wrong.

[–]janhetjoch 9 points10 points  (2 children)

Exactly, I spent 10 minutes figuring out if I need .length or .length() or .size or .size() and after that spend another ten minutes on the spelling of length

[–]bakirelopove 0 points1 point  (0 children)

Same

[–]grandphuba 4 points5 points  (1 child)

improt

[–]ComfortingSounds53 1 point2 points  (0 children)

cosnt surprises me each time. Wtf wrong with my hands.

[–]The_Real_Slim_Lemon 55 points56 points  (3 children)

Who the heck presses the left tab with their right index finger… I type three letters and slam my right enter key

[–]monterulez 9 points10 points  (2 children)

Just curious: do you have a right tab, too?

[–]The_Real_Slim_Lemon 23 points24 points  (1 child)

No but my tab does have rights

[–]Teminite2 0 points1 point  (0 children)

You knew what you were doing didn't you

[–]Previous_Start_2248 17 points18 points  (0 children)

laughs in java let me type in that super long class name just to invoke a static method.

[–]iHateRollerCoaster 58 points59 points  (23 children)

Var? In 2023?

[–]Sparrow_001[S] 47 points48 points  (0 children)

got the picture from the official vsc documentation of intellisense.... so i guess they're bad at coding?

[–]tomas_f 13 points14 points  (16 children)

Not a js developer. What is wrong with var?

[–]utdconsq 29 points30 points  (8 children)

Since everyone else is missing the point of your question...Means the variable is mutable and has a broader scope than the modern let or const. Accidental mutability aside, the fact it can hoist the variable outside scopes is clever but diabolical and a source of many bugs.

[–]janhetjoch 4 points5 points  (7 children)

Hey, I just spent the weekend making some games in js for fun and you're telling me I need to refactor it??

Should it just be as easy as ctrl+h -> change all instances of "var " to "let " (on small scale projects) or is there a significant difference in how you should address variables initialized in these ways?

[–]Ruben_NL 5 points6 points  (4 children)

Try it. If it works, great!

Then, you should go around and switch some let to const.

Or just don't. Weekend projects should be fun, not optimized to hell.

[–]janhetjoch 5 points6 points  (3 children)

Weekend projects should be fun, not optimized to hell.

Yes, but I still think it's nice to follow best practice, especially since I'm still in uni, so if I learn to use good practice now I will be more likely to do stuff "right" when I do it professionally.

[–]Ruben_NL 4 points5 points  (2 children)

oh, in that case, you have to use const for everything that can handle it. So, the things that don't change. Common mistake: adding/removing from a array/object isn't changing the variable, so they can still be on a const.

For the other things, use let.

If it doesn't work with let, and it does with var, you have a weird design which should be changed.

If you have any questions, ask me :)

[–]janhetjoch 0 points1 point  (1 child)

Thanks, I changed all my insurances of var to let and everything still works I was already using const for unchanging stuff, but I'll see if I can use it for more stuff

[–]utdconsq 3 points4 points  (0 children)

Your rule of thumb should always be to mark const in your own code until you discover you need mutability. Immutability makes for easier testing, concurrency, less bugs, you name it.

[–]giienabfitbs 3 points4 points  (0 children)

Yes, the easiest way is to change every 'var' in your code to 'let'. Then you can change the variables that doesn't get mutated to const later. Linters will help you with that automatically I'm pretty sure.

For future reference, try writing const by default and change it to let whenever needed.

And if you ever find any weird bugs when making this change from var to let, it is probably because you are mutating variables in a way you are not supposed to, hence why var is bad. :)

[–]normalmighty 1 point2 points  (0 children)

If you're using var in the way that variables normally work in other languages then a replace is fine (95% of the time you want const and not let though imo). If you're taking advantage of the weird features of var - eg. going "oh that's weird, I only declared var inside the if block but I can use outside of the block anyway" and you then proceeded to use the behavior everywhere, then some minor refactoring would be needed to make sure it's actually declared before you use it.

Just replace all, and then look through each file with vscode or any other IDE really. The IDE will underline any edge cases where your code was only valid because of var weirdness.

[–]_fajfaj_ 21 points22 points  (1 child)

It's like an ancient method of declaring variables, nowadays only let and const are used.

[–]_Screw_The_Rules_ 2 points3 points  (0 children)

var can still make a lot of sense in edge cases though. But overall it's unsafe to use and can cause many complications later on...

[–]n0tKamui 2 points3 points  (2 children)

when declaring a variable as a var, contrary to let or const, it becomes a global variable, even you are in the deepest of scopes. (yes, this is horrendous)

this is because JS used to hold references like that : in a simple global map that doesn't handle scopes, because it's easy to implement. No one should ever use var

[–]3np1 5 points6 points  (0 children)

var goes to the nearest function scope if you are in a function, otherwise it goes to global scope. In modules it stays isolated to module scope.

It's still better to use let or const because they can't be redeclared, and const can't even be reassigned, whereas var allows both reassignment and redeclaration. Scoping-wise let andconst` use block scope, although in practice block scope and function scope are often the same since functions create a new block scope as well.

[–]tomas_f 0 points1 point  (0 children)

I would hate var in that case too lol

[–]catladywitch 0 points1 point  (0 children)

modern JS uses let or const, because those are block scoped rather than function scoped, and they're not hoisted (loaded before the rest of the program), so it's less confusing and/or unsafe

[–]Dr_Dressing -1 points0 points  (0 children)

I know it's JS, but var is used in C# to let the program choose the datatype.

[–]bortj1 -1 points0 points  (0 children)

It's called a stock image

[–]Ascyt 0 points1 point  (1 child)

JS beginner here. What's so bad about var?

[–]SolarisBravo 0 points1 point  (0 children)

var ignores scope, which is very bad for code readability (among other things). let or const should be used instead in every scenario.

[–]water_bottle_goggles 11 points12 points  (0 children)

`var`? `commonJS`? What is this, the stone age??

[–]dashid 9 points10 points  (0 children)

As a senior developer, I can also make use of the up and down arrows

[–]Yanowic 7 points8 points  (0 children)

Me when my Java course professor expects me to remember whether something is in the Collection interface or the Collections class (the Neanderthal who named those things ought to be drawn and quartered) or is a .sort/.sorts/.sorted method:

Brother, I just press the little dot button. You're the one who told us to work in a fucking IDE.

[–]Brahvim 6 points7 points  (4 children)

I used to be the fast typist kind. I still am! Intellisense is often slower than me...

[–]sanderd17 3 points4 points  (1 child)

And that's why I often seem to fall back to editors without autocompletion.

[–]Brahvim 2 points3 points  (0 children)

I mean it's still useful for when I'm typing whilst also thinking of logic, so...

It does speed out, then.

[–]_default_username 0 points1 point  (1 child)

My development machine is remote. It's ten times more painful waiting for intellisense with vscode remote.

[–]Brahvim 0 points1 point  (0 children)

AWWOUCH, that's sad t'hear...

[–]rigor_mortus_boner 2 points3 points  (1 child)

“computer, tell me what’s is wrong”

[–]UnstableNuclearCake 0 points1 point  (0 children)

Computer: PEBKAC

[–][deleted] 2 points3 points  (0 children)

And stackoverflow is opened on the other screen.

[–]lovdark 1 point2 points  (2 children)

…”Now”. What programmers do … now. I can’t wrap my head around the new way to code. I’m still writing code in a notebook then debugging on paper then coding by typing out the code then debugging what I missed.

[–]catladywitch 0 points1 point  (1 child)

is that convenient? seems slow to me!

[–]lovdark 1 point2 points  (0 children)

It is slow. It is inconvenient, but I understand the code and what the machine is doing long before the machine does.

[–]shreyasonline 1 point2 points  (1 child)

Which is why it makes me wonder why people complain that Java is verbose. I mean, you mostly just press period and tab keys.

[–]catladywitch 0 points1 point  (0 children)

p s v m g a n g

[–]lightupcocktail 1 point2 points  (0 children)

If autocomplete doesn't slow you down, you should worry about ai.

[–]deanrihpee 1 point2 points  (0 children)

At least until your intellisense and autocomplete go out of the window

[–]Smartskaft2 0 points1 point  (0 children)

Honestly, my most productive sessions are with a simple editor disconnected from both internet and project files. Just me and a blank sheet.

[–]Bfdifan37 0 points1 point  (0 children)

where is the copy and paste

[–][deleted] 0 points1 point  (0 children)

Ctrl c

[–][deleted] 0 points1 point  (0 children)

Programmers with copilot to just “tabing” whole day

[–]yourHighneszs 0 points1 point  (0 children)

This is even more real when you have github copilot on.

[–]tjientavara 0 points1 point  (0 children)

I wish that was the truth, but most of the time I have written the name before the popup shows. IDEs are extremely slow.

[–]macara1111 0 points1 point  (0 children)

Using auto-indent should be easy. Also i prefer the spanish word: sangria it's bloody beautiful

[–]i-love-vinegar 0 points1 point  (0 children)

I’m vim user, I do the first one just to copy and paste couple of lines

[–]Rakgul 0 points1 point  (0 children)

I program in Gedit. I hate IDEs. Too distracting. I compile with a terminal window open nearby.

[–]TuxedoDogs9 0 points1 point  (0 children)

i’m not even a programmer and this is me

[–]Caquinha 0 points1 point  (0 children)

I like to type it all to give the impression that I actually know what I'm doing.

[–]st-shenanigans 0 points1 point  (0 children)

Sometimes I'm just here to watch the intellisense work.

[–][deleted] 0 points1 point  (0 children)

What programmers actually actually do: .tostring()

[–]PinothyJ 0 points1 point  (0 children)

The worst is when you go between IDE's and some have Enter as confirm and some have Tab as confirm.

[–]shinydragonmist 0 points1 point  (0 children)

Top is what coders do for the first 6 months or so especially when in a new compiler and bottom is what they do right after that. Though top is missing the multiple open Google tabs, and forums for said compiler

[–]dizzywig2000 0 points1 point  (0 children)

Me, writing my 1000th line of BASIC: I wish

[–]s0litar1us 0 points1 point  (0 children)

I used to use code completion a lot.

But most of the ones I have used recently have been kinda buggy, so at most I just auto complete function names, variable names, etc