--- a/src/eric7/QScintilla/Lexers/LexerCSS.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/QScintilla/Lexers/LexerCSS.py Wed Jul 13 14:55:47 2022 +0200 @@ -19,21 +19,19 @@ """ Subclass to implement some additional lexer dependant methods. """ + def __init__(self, parent=None): """ Constructor - + @param parent parent widget of this lexer """ QsciLexerCSS.__init__(self, parent) Lexer.__init__(self) - + self.commentString = "#" - self.streamCommentString = { - 'start': '/* ', - 'end': ' */' - } - + self.streamCommentString = {"start": "/* ", "end": " */"} + self.keywordSetDescriptions = [ self.tr("CSS1 Properties"), self.tr("Pseudo-Classes"), @@ -44,7 +42,7 @@ self.tr("Browser-Specific Pseudo-Classes"), self.tr("Browser-Specific Pseudo-Elements"), ] - + def initProperties(self): """ Public slot to initialize the properties. @@ -52,36 +50,35 @@ self.setFoldComments(Preferences.getEditor("CssFoldComment")) self.setFoldCompact(Preferences.getEditor("AllFoldCompact")) with contextlib.suppress(AttributeError): - self.setHSSLanguage( - Preferences.getEditor("CssHssSupport")) - self.setLessLanguage( - Preferences.getEditor("CssLessSupport")) - self.setSCSSLanguage( - Preferences.getEditor("CssSassySupport")) - + self.setHSSLanguage(Preferences.getEditor("CssHssSupport")) + self.setLessLanguage(Preferences.getEditor("CssLessSupport")) + self.setSCSSLanguage(Preferences.getEditor("CssSassySupport")) + def isCommentStyle(self, style): """ Public method to check, if a style is a comment style. - + @param style style to check (integer) @return flag indicating a comment style (boolean) """ return style in [QsciLexerCSS.Comment] - + def isStringStyle(self, style): """ Public method to check, if a style is a string style. - + @param style style to check (integer) @return flag indicating a string style (boolean) """ - return style in [QsciLexerCSS.DoubleQuotedString, - QsciLexerCSS.SingleQuotedString] - + return style in [ + QsciLexerCSS.DoubleQuotedString, + QsciLexerCSS.SingleQuotedString, + ] + def defaultKeywords(self, kwSet): """ Public method to get the default keywords. - + @param kwSet number of the keyword set (integer) @return string giving the keywords (string) or None """ @@ -101,7 +98,7 @@ " white-space list-style-type list-style-image" " list-style-position list-style" ) - + if kwSet == 2: return ( "link active visited first-child focus hover lang left" @@ -111,7 +108,7 @@ " invalid required optional first-letter first-line before" " after" ) - + if kwSet == 3: return ( "border-top-color border-right-color border-bottom-color" @@ -133,7 +130,7 @@ " speech-rate voice-family pitch pitch-range stress richness" " speak-punctuation speak-numeral" ) - + if kwSet == 4: return ( "background-size border-radius border-top-right-radius" @@ -142,25 +139,17 @@ " column-count column-rule column-gap column-rule-color" " column-rule-style column-rule-width resize opacity word-wrap" ) - + if kwSet == 5: - return ( - "first-letter first-line before after selection" - ) - + return "first-letter first-line before after selection" + if kwSet == 6: - return ( - "^-moz- ^-webkit- ^-o- ^-ms- filter" - ) - + return "^-moz- ^-webkit- ^-o- ^-ms- filter" + if kwSet == 7: - return ( - "indeterminate default ^-moz- ^-webkit- ^-o- ^-ms-" - ) - + return "indeterminate default ^-moz- ^-webkit- ^-o- ^-ms-" + if kwSet == 8: - return ( - "selection ^-moz- ^-webkit- ^-o- ^-ms-" - ) - + return "selection ^-moz- ^-webkit- ^-o- ^-ms-" + return QsciLexerCSS.keywords(self, kwSet)