-
-
-
-
-
-
-
-
Should use "is pygments.token.Name", since it's a class. Or, maybe we want to handle subclasses? I don't know if they even have those or how their lexer really works. Looking at token.py, I see Name, Name.Attribute, Name.Property, etc., which we would want to support, and I don't know how that maps.
-
-
-
Does get_tokens_unprocessed parse the line? I assume so. In this case, do we really even need syntax highlighting enabled for this feature? It seems that even if it's disabled, we should be able to parse the line. It would be nice to be able to get to the original tokens used when syntax highlighting as a performance boost, but I suspect that that's tricky/impossible.
-
-
-
-
Maybe "This file only contains lines with renamed functions, variables, or other content." I want to start making Review Board "sound" better. We're far from being there, but I think there's a lot we could do to make things sound more user-friendly and descriptive.
Enable detection of variable rename on Diff Viewer.
Review Request #1701 — Created July 3, 2010 and discarded
Detection is only active if the user also decides to enable syntax highlight. The rationale is that if he wants to pay for a time consuming feature, he can also pay for the other and both features depends of Pygments for tokenization. That being said, the most time consuming part is the tokenization. I did write a tokenizer by hand (based on regular expressions). but I got caught up in several corner cases (such as the use of $ as a valid token in javascript). Latter on, I just figured that it would be better to use a more robust, albeit heavier, tokenizer to do that job. As a guideline, renames should be one to one, AKA one token changing to another. If there are multiple renames on the same line, it's a special case that shouldn't be overlooked by the reviewer. Also refactor lexer guessing out of apply_pygments so we have to guess it only once.
I'll be adding a test case here, for future automatic testing, but I did test it on several types of diffs.
- Change Summary:
-
Implemented all suggested changes, except for token stream reuse.
- Diff:
-
Revision 2 (+99 -28)