• 
      

    Use real lexer guessing for diffviewer syntax highlighting.

    Review Request #7682 — Created Oct. 8, 2015 and submitted

    Information

    Review Board
    release-2.0.x
    337
    15caa11...

    Reviewers

    Once upon a time, we used Pygments' guess_lexer_for_filename for the diff
    viewer. This turned out to be incredibly slow for large XML files, so we
    switched it out for get_lexer_for_filename, which just chooses the first (in
    alphabetical order) lexer that matches the filename, rather than trying to
    determine how appropriate that lexer actually is.

    Since then, we've added multiple layers of caching in the diff viewer, a
    maximum file size for syntax highlighting, and maximum sizes for uploaded
    diffs, so we don't have to worry about parsing multi-megabyte XML files.
    This change switches us back to the better lexer guessing.

    Created a patch with an XML file that was problematically highlighted as an
    "Evoque XML" file. Saw that it was rendered nicely.

    reviewbot
    1. Tool: Pyflakes
      Processed Files:
          reviewboard/diffviewer/chunk_generator.py
      
      
      
      Tool: PEP8 Style Checker
      Processed Files:
          reviewboard/diffviewer/chunk_generator.py
      
      
    2. 
        
    gmyers
    1. Please, please, please now recognize my .m files as Matlab :)
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-2.0.x (944a86d)