From 9e7440c01d917021790e896f47ef834770ae1d62 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Sun, 8 Mar 2020 23:00:12 -0400 Subject: exclude SqlLexer from guessing --- syntax-highlighting-server.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/syntax-highlighting-server.py b/syntax-highlighting-server.py index 48482cc..aa6c570 100755 --- a/syntax-highlighting-server.py +++ b/syntax-highlighting-server.py @@ -70,6 +70,9 @@ class HighlightingHandler(BaseHTTPRequestHandler): except ClassNotFound: try: lexer = guess_lexer(data) + # SqlLexer always gives 0.01 + if lexer.analyse_text(data) <= 0.01: + lexer = TextLexer() except ClassNotFound: lexer = TextLexer() self.wfile.write(('