catch exceptions from pygments.modeline.get_filetype_from_buffer
This commit is contained in:
parent
4b6aee218b
commit
61b9989641
1 changed files with 6 additions and 1 deletions
|
@ -135,7 +135,12 @@ def guess_lexer_using_modeline(text):
|
|||
|
||||
lexer, accuracy = None, None
|
||||
|
||||
file_type = get_filetype_from_buffer(text)
|
||||
file_type = None
|
||||
try:
|
||||
file_type = get_filetype_from_buffer(text)
|
||||
except:
|
||||
pass
|
||||
|
||||
if file_type is not None:
|
||||
try:
|
||||
lexer = get_lexer_by_name(file_type)
|
||||
|
|
Loading…
Reference in a new issue