Notifications
Clear all

Comment blocks

26 Posts
7 Users
6 Likes
215 Views
barrie
(@barrie)
Trusted Member
Joined: 3 months ago
Posts: 86
Topic starter  

Is there a shortcut that will apply a block comment to a few lines of selected code?


   
Quote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 966
 

🤣 🤣 🤣 - You would have to be using a real editor first to get that capability.  Maybe someone using 2.0 has a nicer/better opinion.  

Do you... or have you used some other editor in the past that you feel fluent?  Like Notepad++, Notepad2, Eclipse, heck even VI if that's your thing?  There is an option in the preferences in 1.8.X series that lets you use an external editor and just use the Arduino IDE as the compiler.  The Arduino IDE will recognize when you save the file and reload it automatically so when you press the Upload button, it'll load the updated version and compile away.

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 1 year ago
Posts: 2140
 
Posted by: @barrie

Is there a shortcut that will apply a block comment to a few lines of selected code?

Move to the beginning of the first line you want to comment, and enter

/*

then move to the end of the last line you want to comment and add

<carriage return>*/

That will turn the block into a comment.

Experience is what you get when you don't get what you want.


   
ReplyQuote
Ron
 Ron
(@zander)
Famed Member
Joined: 2 years ago
Posts: 3462
 

@will I think he was looking for a shortcut like many other editors have, select a block, press a key combo and voila a block comment. Some of these guys are real old and can't afford to waste time.

"Don't tell people how to do things. Tell them what to do and let them surprise you with their results.” - G.S. Patton, Gen. USA
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 1 year ago
Posts: 2140
 

@zander 

I understand that, but he'd have to drag over the area anyway, so adding 5 keystrokes (instead of maybe 2 or 3 for an extended command) isn't much extra overhead PLUS it's easier to remove afterwards.

Experience is what you get when you don't get what you want.


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 966
 
Posted by: @zander

Some of these guys are real old and can't afford to waste time.

Pot calling the kettle black? 😆 

@will - Yes, @zander is right... many editors have the ability to select a block and it can optionally do it as a block like you suggested with /*... */ or it will do every line with "//".  Comes in handy when you want to block out a bunch and un-block certain lines piece-meal as you try to locate some bug.

And yes... either way... it's real minor convenience.  

I only use it once in a blue-moon.

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 1 year ago
Posts: 2140
 
Posted by: @inq
Posted by: @zander

Some of these guys are real old and can't afford to waste time.

Pot calling the kettle black? 😆 

My post count has passed my birth year, so I believe that puts me in the "old as dirt" category myself.

@will - Yes, @zander is right... many editors have the ability to select a block and it can optionally do it as a block like you suggested with /*... */ or it will do every line with "//".  Comes in handy when you want to block out a bunch and un-block certain lines piece-meal as you try to locate some bug.

And yes... either way... it's real minor convenience.  

I know that some editors will do that but IDE 1.8... isn't one of them. That's why I suggested an alternative which IS available on the editor in use.

The real downside of /* ... */ is when it comes to embedded comments of the same type - ouch.

Experience is what you get when you don't get what you want.


   
ReplyQuote
barrie
(@barrie)
Trusted Member
Joined: 3 months ago
Posts: 86
Topic starter  

I guess the answer is no. I am doing a lot of debugging by blocking out code and a drag and tap would have been handy. Thanks for the info.


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 966
 
Posted by: @will

The real downside of /* ... */ is when it comes to embedded comments of the same type - ouch.

Oh hail yeah!  I only use // in my comments just for that reason... so I can use /* */ in emergencies.  It just simply won't do to have me calling myself ora dumb, sum, bitch.  We can't have division in here being as old as we are.  

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 1 year ago
Posts: 2140
 

@barrie 

You may find it easier to develop a new sketch but adding only one new component at a time, wiring it in and then writing and debugging the code and then moving on to the next part.

What this does is leave you in the situation that only the LAST part you added caused the problem instead of trying to find a conflict or error amongst ALL of the parts at once.

Or maybe not 🙂

Experience is what you get when you don't get what you want.


   
Inq reacted
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 8 months ago
Posts: 966
 
Posted by: @will

What this does is leave you in the situation that only the LAST part you added caused the problem instead of trying to find a conflict or error amongst ALL of the parts at once.

100% concur!!!  Baby steps - hardware or software!  And either have some good code-repository software so you can check-in changes that you can easily back-up/out to any version you've ever done... or zip up the folder at every milestone.

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, Access Point Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
frogandtoad reacted
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 1 year ago
Posts: 2140
 

@inq 

Yeah, I like to zip the folder on those rare occurrences where something works. I usually rename it to something that emphasizes which new part or operation succeeded.

Experience is what you get when you don't get what you want.


   
ReplyQuote
barrie
(@barrie)
Trusted Member
Joined: 3 months ago
Posts: 86
Topic starter  

@will I have been modifying and compiling existing code line by line. When it compiles OK I save it and repeat the mod-compile-save procedure on the next line. It was working very well until I hit a perplexing bug that I couldn't fix. error was ....stray ". It took me a while to admit defeat so I closed the sketch and opened the last saved. AAARRRRGHHH! The same bug was on my "clean file". Auto Save was on and I knew it. However I had assumed it would save a backup file and not save to my working file. Lesson learned: Turn off auto save and assume nothing. 


   
ReplyQuote
Will
 Will
(@will)
Famed Member
Joined: 1 year ago
Posts: 2140
 

@barrie 

Yeah, you never really learn anything by doing it right the first time 🙂

Experience is what you get when you don't get what you want.


   
ReplyQuote
barrie
(@barrie)
Trusted Member
Joined: 3 months ago
Posts: 86
Topic starter  

Funny you said that, I used to tell my daughters that I could make anything if I had two goes at it.


   
ReplyQuote
Page 1 / 2