changeset 35329:169d66db5920

highlight: eagerly discover plugin lexers while demandimport is off Since highlight is only relevant for servers, it seems worthwhile to just trigger this eagerly, which avoids really weird traceback problems caused by demandimport messing with some of the lexer plugins. Differential Revision: https://phab.mercurial-scm.org/D1619
author Augie Fackler <augie@google.com>
date Fri, 08 Dec 2017 16:14:19 -0500
parents 4937db58b663
children 0c1aff6d73a7
files hgext/highlight/highlight.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/highlight/highlight.py	Fri Dec 08 17:20:11 2017 +0900
+++ b/hgext/highlight/highlight.py	Fri Dec 08 16:14:19 2017 -0500
@@ -22,8 +22,12 @@
     import pygments
     import pygments.formatters
     import pygments.lexers
+    import pygments.plugin
     import pygments.util
 
+    for unused in pygments.plugin.find_plugin_lexers():
+        pass
+
 highlight = pygments.highlight
 ClassNotFound = pygments.util.ClassNotFound
 guess_lexer = pygments.lexers.guess_lexer