开发者

Ignore comments in search VS2010 C#

Is there any way to have Find ignore a开发者_运维百科ny occurrences of the query that are in a commented line? It's making some find / replace operations very time consuming.

Thanks,

PM


I'm wondering if the root cause of your trouble is that you have a lot of commented out historical code. That is the #1 thing I've seen that produces excessive comment lines. If so, use a proper version control system to preserve it, and then delete the old commented out code. This is a best practice.


No easy way. Find/Replace does support regular expression syntax, but setting up a regex that ignored commented code and still worked properly is beyond my tiny brain.


I'm sorry to say a similar feature used to exists in VS 2008 as "Search hidden text" checkbox in Find dialog, but it has been removed in VS 2010. Anyway, I'm not entirely sure having such a function would improve performance significantively. Even ignoring all text in comments from CPU consuming operations such verifying a regex, you always need to entirely read uncached files until EOF (and uncached means slow I/O operations are needed to load them in memory). No way to really not read "comments" unless files are cached in memory with an optimized structure, such a linked list of chunks of uncommented code.


If it is a refactor operation eg Rename, then you can probably skip comments by using the refactor tools.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜