Author |
Topic |
|
jschroedl
Tomato Guru
USA
107 Posts |
Posted - Apr 13 2015 : 08:35:54 AM
|
I am trying out the new VA Hashtags feature and it's somewhat promising but we have a snag with some code which does XML parsing.
We have a lot of comments similar to this excerpt:
/**
* IS_EXTENDER:
* @c: an UNICODE value (int)
*
* Macro to check the following production in the XML spec:
*
*
* [89] Extender ::= #x00B7 | #x02D0 | #x02D1 | #x0387 | #x0640 |
* #x0E46 | #x0EC6 | #x3005 | [#x3031-#x3035] |
* [#x309D-#x309E] | [#x30FC-#x30FE]
*/
Unfortunately, that leaves me with a whole truckload of tags which aren't really tags in the VA Hashtags list.
Any advice? I'd rather not touch these comments as they are correct (and not my code).
|
|
accord
Whole Tomato Software
United Kingdom
3287 Posts |
Posted - Apr 13 2015 : 10:32:43 AM
|
Yes, since VA Hashtags have a short tag, a hash, you will have some unrelated stuff as well in your code. Personally, I love the fact that this solution is short, elegant, and works the same way as hashtags anywhere else. But yes, I will not pretend that this is not a real problem. What I usually do is just filter using the editbox on the top of the VA Hashtags window. If you press alt+shift+h (the shortcut for VA Hashtags) the window will be opened (or get focused if it was already open) and the filter editbox will have focus so you can type right away.
One solution would be to change the tag other than just a hash, but I wouldn't do that. It's simple, it's intuitive, other devs can use it, project and company independent, etc. Filtering is fine for me because I wouldn't usually need other's hashtags since hashtags can be kind of personal to some extent, since they're like bookmarks. Other times when you try to find something in the code, filtering is also great.
But if you really don't like the unnecessary items, one solution would be to implement so users could use a list of permanent negative filters in the form of regular expressions that would filter out unnecessary stuff. A downcase 'x' and 2 upcase hexa numbers or a downcase 'x' and 4 upcase hexa numbers, in you case.
What do you think? |
Edited by - accord on Apr 13 2015 10:34:21 AM |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Apr 13 2015 : 11:58:25 AM
|
You can also change the default value of HashtagsMinTagLength from 3 to 6. |
Edited by - sean on Apr 13 2015 12:00:25 PM |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Apr 13 2015 : 12:11:24 PM
|
#4E00 is not considered a hashtag because it is a hex value. The x is causing that check to fail in #x4E00. case=89057 |
Edited by - sean on Apr 13 2015 12:11:52 PM |
|
|
jschroedl
Tomato Guru
USA
107 Posts |
Posted - Apr 14 2015 : 07:16:05 AM
|
Thanks for the good responses.
Thanks for adding a case for the #x. Here's the spec mentioning that it's a valid character reference (in case it comes up): http://www.w3.org/TR/REC-xml/#dt-charref
After using this for the day, I'm with @accord now and I've set the filter to a prefix for what I'm interested in and things seem perfectly usable.
I like the option of upping HashtagsMinTagLength in case this becomes annoying for other devs on the team.
|
|
|
feline
Whole Tomato Software
United Kingdom
19022 Posts |
Posted - Apr 14 2015 : 7:08:08 PM
|
Adding the ability to exclude some tags from the list makes sense, and is worth considering. I have put in a feature request for this to see what our developers make of it:
case=89098 |
zen is the art of being at one with the two'ness |
|
|
nitz
Junior Member
21 Posts |
Posted - Apr 16 2015 : 09:57:18 AM
|
I have the sqlite.c code in my project. It has some comments in my code that are like: #AAAA (which is a hex value), and that shows up as a hashtag. (Though from sean's comment, I feel like it shouldn't!) It also uses some other things that get registered as hashtags that shouldn't (as like #NNN for describing a number.) It'd be lovely if we could add rules (say maybe, regular expressions, that if they match, the hashtag is skipped?) to attempt to de-clutter?
As well, if a comment has a url in the that looks something like
// visit this link http://example.com/page.php#faq_18
Then a hashtag will show up for faq_18.
Perhaps hashtags should be ignored if they're part of a URL like that? That's obviously a very specific case, but not completely uncommon.
Cheers |
|
|
holedigger
Whole Tomato Software
145 Posts |
Posted - Apr 16 2015 : 11:34:28 AM
|
In the case of #AAAA it isn't ignored because there are no digits, the same reason we don't ignore #deadbeef or #face. Perhaps we could ignore #AAAA because it is ALLCAPS? But that doesn't help #NNN.
We have tried to minimize spurious tags, but we are exploring ways of explicitly excluding them. In addition to a tag-by-tag filter (ie, regex) would you want to exclude by file? by project? |
Whole Tomato Software |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
|
nitz
Junior Member
21 Posts |
Posted - Apr 16 2015 : 1:34:59 PM
|
My gut instantly says by file would be the most useful quickly. (Especially if I could ignore by wildcard patterns, such as "sqlite*", or ignore all C files by "*.c", etc.
As for excluding entire projects, I could see that being handy when I just wanted to focus on projects I'm responsible for.However, using the filter in the VA Hashtags window would probably get me where I wanted to go faster than trying to add a project to ignore anyways. Not to say that it wouldn't be useful though, so if we were using a project developed by someone who also made extensive use of hashtags, we could easily disregard them. I definitely see the benefit of it.
@sean: Good catch! I didn't even notice that myself. |
Edited by - nitz on Apr 16 2015 1:35:49 PM |
|
|
sean
Whole Tomato Software
USA
2817 Posts |
Posted - Jun 11 2015 : 2:43:08 PM
|
case=89057, case=89145, case=89172 and case=89445 are implemented/fixed in build 2068 |
|
|
pwc
Tomato Guru
138 Posts |
Posted - Jul 23 2015 : 11:26:00 AM
|
We happened to have a few hundred occurrences of #blah in our code base. I'd like the option to use an alternate character or character sequence. I'd probably try ##. |
|
|
|
Topic |
|