eric7/QScintilla/Lexers/LexerPygments.py

branch
eric7
changeset 8407
d6f374ab42eb
parent 8318
962bce857696
child 8881
54e42bc2437a
equal deleted inserted replaced
8406:45d7d0eec4d3 8407:d6f374ab42eb
453 elif text: 453 elif text:
454 # step 1: guess based on filename and text 454 # step 1: guess based on filename and text
455 if self.editor is not None: 455 if self.editor is not None:
456 fn = self.editor.getFileName() 456 fn = self.editor.getFileName()
457 if fn: 457 if fn:
458 with contextlib.suppress(ClassNotFound): 458 with contextlib.suppress(ClassNotFound, AttributeError):
459 lexer = guess_lexer_for_filename(fn, text) 459 lexer = guess_lexer_for_filename(fn, text)
460 460
461 # step 2: guess on text only 461 # step 2: guess on text only
462 if lexer is None: 462 if lexer is None:
463 with contextlib.suppress(ClassNotFound): 463 with contextlib.suppress(ClassNotFound, AttributeError):
464 lexer = guess_lexer(text) 464 lexer = guess_lexer(text)
465 465
466 return lexer 466 return lexer
467 467
468 def canStyle(self): 468 def canStyle(self):

eric ide

mercurial