Notifications
Clear all

Comment blocks

26 Posts
7 Users
6 Likes
1,032 Views
barrie
(@barrie)
Member
Joined: 2 years 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)
Member
Joined: 2 years ago
Posts: 1900
 

🤣 🤣 🤣 - 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, WiFi 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)
Member
Joined: 3 years ago
Posts: 2504
 
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.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6665
 

@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.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2504
 

@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.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 
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, WiFi 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)
Member
Joined: 3 years ago
Posts: 2504
 
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.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
barrie
(@barrie)
Member
Joined: 2 years 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)
Member
Joined: 2 years ago
Posts: 1900
 
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, WiFi 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)
Member
Joined: 3 years ago
Posts: 2504
 

@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 🙂

Anything seems possible when you don't know what you're talking about.


   
Inq reacted
ReplyQuote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 
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, WiFi 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)
Member
Joined: 3 years ago
Posts: 2504
 

@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.

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
barrie
(@barrie)
Member
Joined: 2 years 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)
Member
Joined: 3 years ago
Posts: 2504
 

@barrie 

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

Anything seems possible when you don't know what you're talking about.


   
ReplyQuote
barrie
(@barrie)
Member
Joined: 2 years 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