New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CSS pseudo-elements not recognized issue #10501
Conversation
Update CSS keywords and add new styles. Fix notepad-plus-plus#10425
PowerEditor/src/stylers.model.xml
Outdated
@@ -342,6 +342,17 @@ | |||
<WordsStyle name="ID" styleID="10" fgColor="0080FF" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" /> | |||
<WordsStyle name="IMPORTANT" styleID="11" fgColor="FF0000" bgColor="FFFFFF" fontName="" fontStyle="1" fontSize="" /> | |||
<WordsStyle name="DIRECTIVE" styleID="12" fgColor="0080FF" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" /> | |||
<WordsStyle name="DOUBLESTRING" styleID="13" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" /> | |||
<WordsStyle name="SINGLESTRING" styleID="14" fgColor="808080" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" /> | |||
<WordsStyle name="IDENTIFIER2" styleID="15" fgColor="0040E0" bgColor="FFFFFF" fontName="" fontStyle="0" fontSize="" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@donho
IDENTIFIER2, IDENTIFIER3, EXTENDED_IDENTIFIER, EXTENDED_PSEUDOCLASS, EXTENDED_PSEUDOELEMENT will not work without coresponding list for them: LIST_2, LIST_3, LIST_5, LIST_6,, LIST_7 setting by setLexer()
as above.
https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/scintilla/lexers/LexCSS.cxx#L75
Could be listed all of them in this fix, then in future it will be easier to add something in the langs.model.xml
itself, without asking you to add some missing list again in ScintillaEditView.h
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For CSS2 & CSS3 (IDENTIFIER2 & IDENTIFIER3 respectively) are in current existing list, so I don't think we will add (separate) them in the future. Anyway, I will comment all not used keyword lists for the eventual future added.
Thank you for your review.
@donho |
@ArkadiuszMichalski |
And it's correct, because Like I wrote here #10425 (comment), there is a trick to handle
Now bot |
You have mentioned in #10425 (comment) :
So I suppose :after should be recognized. Now my question is: if |
It would be most appropriate, but the lexer does not understand it now (it can only consider them as pseudo-classes or use abve trick).
Yes, for sure these 4 old ones are valid in the browser (here nobody wants to break backwards compatibility), I did not check the rest (because it is possible that all pseudo-elements with ":" are supported in browsers). I'll check it out later.
It would be most appropriate, then the question is how? Some options:
Edit: I checked this and browsers recognize only this 4 pseudoelement with old notation ( I would also add |
OK, I'll do the following:
Which keywords should I remove from PsudoClass besides of |
also |
BTW, since |
You mean this?
This will work, can we point to any list using keywordClass attr? If so, it would be better. Edit: no, it will not work. Test:
|
But we can do this:
We can use any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check last comment #10501 (comment).
<!--WordsStyle name="IDENTIFIER3" styleID="17" fgColor="00A0E0" bgColor="3F3F3F" fontName="" fontStyle="0" fontSize="" /--> | ||
<WordsStyle name="PSEUDOELEMENT" styleID="18" fgColor="CEDF99" bgColor="3F3F3F" fontName="" fontStyle="0" fontSize="" keywordClass="type3"/> | ||
<!--WordsStyle name="EXTENDED_IDENTIFIER" styleID="19" fgColor="7F7F00" bgColor="3F3F3F" fontName="" fontStyle="0" fontSize="" /--> | ||
<WordsStyle name="EXTENDED_PSEUDOCLASS" styleID="20" fgColor="CEDF99" bgColor="3F3F3F" fontName="" fontStyle="0" fontSize="" keywordClass="type5" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make analogous correct as in stylers.model.xml
.
PowerEditor/src/langs.model.xml
Outdated
<Keywords name="instre2">active after before check checked disabled empty enabled first first-child first-letter first-line first-of-type focus hover indeterminate invalid lang last-child last-of-type left link not nth-child nth-last-child nth-of-type nth-last-of-type only-child only-of-type optional read-only read-write required right root selection target valid visited</Keywords> | ||
</Language> | ||
<Keywords name="instre2">active check checked disabled empty enabled first first-child first-of-type focus hover indeterminate invalid lang last-child last-of-type left link not nth-child nth-last-child nth-of-type nth-last-of-type only-child only-of-type optional read-only read-write required right root target valid visited</Keywords> | ||
<Keywords name="type3">after before first-letter first-line selection cue file-selector-button placeholder slotted part</Keywords> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add marker
here.
Update CSS keywords and add new styles.
Fix #10425