Rubberduck: TODO Explorer picking up a "done" in the text of a comment when it shouldn't

Created on 31 Aug 2019  路  6Comments  路  Source: rubberduck-vba/Rubberduck

Rubberduck version information
Version 2.4.1.4901
OS: Microsoft Windows NT 10.0.18362.0, x64
Host Product: Microsoft Office x86
Host Version: 16.0.11901.20218
Host Executable: EXCEL.EXE

Description
In the "Done" group a line of comment using the word "done" shows up when it is not really a "Done" annotation (or whatever it should be called.

To Reproduce
Steps to reproduce the behavior:

  1. add a "Done" to the todo settings
  2. create a comment containing the word done: "module contains info on what was done..."
  3. open the Todo Explorer
  4. See that line

Expected behavior
Only a "Done" as the first word in a comment line should show up in the TE

Screenshots
If applicable, add screenshots to help explain your problem.
image
Logfile
RubberduckLog.txt

difficulty-01-duckling enhancement feature-todo-explorer

Most helpful comment

TBH, I never liked the R# behavior of matching the marker anywhere in the text. 99.9999% of time, I want the marker following the comment marker and maybe whitespace, no more. KISS.

All 6 comments

If any text (e.g. "todo") is found anywhere in a comment line that will be picked up by the TE? I didn't think that was the way it was intended to work; I thought it was only supposed to pick up the string as the first characters in a comment line. My apologies for reporting this as a bug if anywhere in a comment line is the desired behavior.

@SmileyFtW no, my apologies for not actually replying with a comment! I meant to put up a screenshot of how R# matches markers in VS and explain that indeed it was intended to work that way - but if it feels wrong, then it should probably be more flexible. Would exposing a regex pattern make todo markers too complicated to configure? I don't think the majority of VBIDE users are comfortable with regex...

A consideration against exposing a regex pattern -- aren't there differences between .NET regex syntax and the VBScript regex syntax used in VBA? Would it be possible/better to leverage the VBScript regex engine for this?

Perhaps allowing only a Like pattern?

TBH, I never liked the R# behavior of matching the marker anywhere in the text. 99.9999% of time, I want the marker following the comment marker and maybe whitespace, no more. KISS.

@zspitz the primary consideration against exposing a regex pattern would IMO be the potential for the user to accidentally completely deadlock the parsing/recognition process. The VBScript flavored regexes are baaically a strict subset of the .NET regexes.

Overall, I'd vote for the simplification proposed by @bclothier. This means we'd wrap the todo marker into $"^\\s*{pattern}\\b" so we only match the todo marker as a single word at the beginning of a comment. (The pattern still needs to be escaped here)

I just don't see much of a usecase for pattern based todo markers...

I wouldn't know what to do with a regex pattern, and it seems like a big can of nasty worms to open. That being said, I am with blothier in that I expect to use the TE tags as the first thing after the opening single-quote (or multiple ones) and possibly with some whitespace ahead of the tag... nothing more. I had simply thought that was the design and the way it worked until I put that "done" in a comment and discovered otherwise. My other tags (todo, nextup) are not likely to ever pop up like "done" did as part of a real comment.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

retailcoder picture retailcoder  路  4Comments

philippetev picture philippetev  路  3Comments

Gener4tor picture Gener4tor  路  3Comments

retailcoder picture retailcoder  路  3Comments

ChrisBrackett picture ChrisBrackett  路  3Comments