eric6/QScintilla/Lexers/LexerXML.py

changeset 8243
cc717c2ae956
parent 7923
91e843545d9a
diff -r aa713ac50c0d -r cc717c2ae956 eric6/QScintilla/Lexers/LexerXML.py
--- a/eric6/QScintilla/Lexers/LexerXML.py	Thu Apr 15 16:52:05 2021 +0200
+++ b/eric6/QScintilla/Lexers/LexerXML.py	Thu Apr 15 18:11:24 2021 +0200
@@ -7,6 +7,8 @@
 Module implementing a XML lexer with some additional methods.
 """
 
+import contextlib
+
 from PyQt5.Qsci import QsciLexerXML
 
 from .Lexer import Lexer
@@ -48,14 +50,12 @@
         self.setCaseSensitiveTags(
             Preferences.getEditor("HtmlCaseSensitiveTags"))
         self.setFoldCompact(Preferences.getEditor("AllFoldCompact"))
-        try:
+        with contextlib.suppress(AttributeError):
             self.setFoldScriptComments(
                 Preferences.getEditor("HtmlFoldScriptComments"))
             self.setFoldScriptHeredocs(
                 Preferences.getEditor("HtmlFoldScriptHeredocs"))
             self.setScriptsStyled(Preferences.getEditor("XMLStyleScripts"))
-        except AttributeError:
-            pass
     
     def isCommentStyle(self, style):
         """

eric ide

mercurial