-
Notifications
You must be signed in to change notification settings - Fork 30
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse Multiline Todos #13
Comments
hm... This is tricky... What would you use as a delimiter to tell from legit comments (as a continuation) vs code on the next line? |
I would've assumed a blank line, but I could see how some people might expect that to be a new comment. Another option would be to check indentation:
|
I accept PR's :). I'd like to add a bunch of test cases for this to be more stable. At that point testing scenarios like this will be much easier. |
Is this a common use case? Anybody else want this? |
Sorry, I've been super busy lately but this is definitely still on my radar. (Maybe I write more detailed TODOs than most though.) |
I would also find this useful as I also tend to have a couple of lines for TODOs. I vote for blank line as delimiter, but also any line that doesn't start with a comment (sans leading whitespace). E.g. # TODO improve needs_improvement function
# details about improvements to make
def needs_improvement # this really needs improvement
...
end So in the above example, the first two lines constitute a multi-line TODO and everything else is irrelevant. |
Two questions as we explore this:
|
I think a neat approach (assuming this is realistically doable) would be to display the TODOs as an accordion. In a collapsed state it would show just the line containing the TODO and in an expanded state it would show the subsequent lines. Maybe an option could be added to default to a collapsed or expanded state. This way it could be used as either (or both). |
There's also the case of non-start-of-line comments, in which case following comments are probably not intended as a continuation of the TODO, although it is possible. def needs_improvement # TODO: improve this
# Set up the things
...
# Do the things
...
end |
The Ruby Style Guide recommends indentation for multiple lines:
|
What if people had to do
So if it already detects a TODO by the string "TODO" then it would parse that and if a number comes between the 'O' and the ':' then it would assume that anything else that matches, would be part of the same TODO? |
@suark If it came down to syntax that you have to follow, |
I do not think these EOL markers or weird start syntaxes will ever be naturally used by developers writing todos in a hurry. If there were a bulletproof way of parsing these multiline todos, without adding magic characters, I would consider adding this feature. I would probably not use it myself, because I believe todos should be concise and extra notes should be added elsewhere. Take a look point 2 of at what @jamischarles originally wrote #13 (comment). |
others use indentation to do multiline TODOs, e.g. please see |
If you're using a linter to limit line length, you can easily end up breaking up a single TODO into multiple lines. It would be awesome if that would be recognized and the full TODO text shown.
The text was updated successfully, but these errors were encountered: