Find Excluding Comments

I think it would be useful for the Find in the IDE to optionally exclude commented out lines in its results. If one selects Exclude comments, any line starting with ’ or // would not show up.

Anyone else think this would be useful? Or, is the feature already there and I don’t know about it?

-Bob

I think that would be counter productive, comments can have some very useful information. I find myself searching for comments sometimes as well.

Tim,

I agree. I also sometimes look for things in comments. The idea is that this is something you could turn on or off as needed. In fact, if you knew something was in a comment, perhaps one could show only comment lines (line starts with ’ or //).

on the subject of comments… would be REALLY REALLY helpful to have BLOCK COMMENTS

/*  
my comment
goes on for 
a few lines
and I don't want to 
comment out
each and every
individual one
*/

and don’t bother suggesting I submit a feature request… I gave up on trying to get the feedback system to work long ago

and make them collapsible

That’s one of the first feature requests I made actually, <https://xojo.com/issue/33413>

I was told to select multiple lines and use the comment line function… >_>

Personally I consider a response like that a “cop-out”… Tell us … “No, we won’t implement that, sorry”, or “Its under consideration”, or “Wow, why did we leave that out in the beginning anyways”…

Instead the response is a “band-aid”

If “we” didn’t think it was a beneficial addition (duh almost every other language in existance has /* */), we probably would not have brought it up (sorry didn’t mean to hijack the intent of this thread)

Sort by Type and the Comment results are collected into 1 clump instead of sprinkled throughout.

A regex search for “^[^’//].*test” would at least exclude comments at the start of a line.

You can use a regular expression to exclude comments. For example, this will find an “if” if it’s not in a comment.

^((?!//|').)*\\bif\\b

Thanks for the regex suggestions. However, I find regex really ugly. (That may be just me.)

-Bob

Well, it ain’t pretty. :slight_smile:

depends on your definition of pretty. I like it. But then again I am not the norm these days. I came from the old school UN*X days where you did RegEx in everything (grep/perl/awk/sed/etc) constantly…

This wouldn’t work as expected since it would exclude any line where a single “/” preceded the search term. Why? Because tokens within a character class are considered individually, so there is no difference between any of these:

[/]
[//]
[////////////////]

Each would match a single “/”.


  1. ^'// ↩︎

ArchiveXojo is free database tool that acts as a repository of your code. One feature of that database is that you can search your code for strings and exclude comments from the search