Closed Phanx closed 9 years ago
Like I said in the other ticket, always check what works with Scite.
Apart from that, I will need a patch which then I will try to review. It's impossible to maintain all languages by myself.
I'm not sure how this issue could be related to SciTE, as all of the keywords for all of the languages Notepad2-mod supports are listed in src/Styles.c which doesn't appear to be part of the SciTE source.
I've never touched C++ but I will do my best to copy and paste the missing keywords without breaking anything...
Here you go:
https://github.com/XhmikosR/notepad2-mod/pull/47
It also looks like you could easily support separate highlighting for pseudo-classes and pseudo-elements by splitting line 304 in src\Styles.c:
{ MULTI_STYLE(SCE_CSS_PSEUDOCLASS,SCE_CSS_EXTENDED_PSEUDOCLASS,SCE_CSS_PSEUDOELEMENT,SCE_CSS_EXTENDED_PSEUDOELEMENT), 63197, L"Pseudo-class/element", L"fore:#B000B0", L"" },
into two:
{ MULTI_STYLE(SCE_CSS_PSEUDOCLASS,SCE_CSS_EXTENDED_PSEUDOCLASS), 63197, L"Pseudo-class", L"fore:#B000B0", L"" },
{ MULTI_STYLE(SCE_CSS_PSEUDOELEMENT,SCE_CSS_EXTENDED_PSEUDOELEMENT), 63197, L"Pseudo-element", L"fore:#B000B0", L"" },
However, I did not include this in my pull request, as I have no idea how localization (L"text") is handled or whether anything needs to be added anywhere else to support this change.
Scintilla's CSS lexer can actually separately support
SCE_CSS_IDENTIFIER
)SCE_CSS_PSEUDOCLASS
)SCE_CSS_IDENTIFIER2
)SCE_CSS_IDENTIFIER3
)SCE_CSS_PSEUDOELEMENT
)SCE_CSS_EXTENDED_IDENTIFIER
)SCE_CSS_EXTENDED_PSEUDOCLASS
)SCE_CSS_EXTENDED_PSEUDOELEMENT
) In other words, if we really wanted to, we could support different styles for each of these types of keywords.
I think there's just always been a consensus that it's not worth the effort. If anything, I would propose refactoring CSS1 properties as what's part of modern spec and currently supported in most browsers; CSS2 as deprecated properties; and CSS3 as modern or future spec unsupported in most browsers. Since these are all more or less cosmetic changes, it shouldn't be an issue to simply refactor them if anyone ever wants to go through the trouble. Personally I just don't see the point.
Highlighting CSS1/2/3 properties separately wouldn't be useful; I don't care which spec first included "height", for example. Same goes for highlighting vendor-specific properties separately; ideally those wouldn't exist at all, but since they do, they really aren't any different than standard properties.
However, highlighting pseudo-classes and pseudo-elements separately is useful. For example, if I use CSS to set the content of an element selected with a pseudo-class -- img:first-child { content: "X" }
-- the selected img
element will be replaced by a single "X" character. But if I set the content of an element selected with a pseudo-element -- img::before { content: "X" }
-- a new element is created before the selected img
element with a single "X" character as its contents. They serve separate roles.
I'll have a look later today or tomorrow. Thanks for the patches.
Version: Notepad2-mod (64-bit) 4.2.25 r858 (3f0683d) Operating system: Windows 7 Professional (64-bit)
Summary:
The schemes for HTML ("Web Source Code") and CSS ("CSS Style Sheets") are both missing a number of keywords. These keywords are currently highlighted using the "unknown" settings for their respective context. To resolve the issue, they should be added to the appropriate keyword lists in Notepad2-mod.
For example, if you set the scheme to "Web Source Code" and type
<main>
, that element tag will be displayed using the settings for "HTML Unknown Tag" instead of the settings for "HTML Tag".Missing HTML elements (Should use: Web Source Code > HTML Tag)
main
menuitem
Missing deprecated HTML elements: (Should use: Web Source Code > HTML Tag)
These elements are deprecated and not part of any current standard, and some are ignored entirely by modern browsers. However, since some deprecated elements are included in the HTML highlighting scheme, I'm not sure whether you want to support old stuff or not. Let me know if you want the reverse of this list (deprecated elements that are currently recognized but chould be removed).
bgsound
blink
listing
marquee
nobr
plaintext
spacer
xmp
Missing HTML attributes: (Should use: Web Source Code > HTML Attribute)
buffered
crossorigin
download
irrelevant
itemprop
mediagroup
muted
oncancel
onclose
translate
typemustmatch
Missing CSS @rules: (Should use: CSS Style Sheets > Directive)
@media
Missing CSS properties: (Should use: CSS Style Sheets > CSS Property)
animation-fill-mode
aspect-ratio
clip-path
clip-rule
flex
flex-basis
flex-direction
flex-flow
flex-grow
flex-shrink
flex-wrap
flow-from
flow-into
font-feature-settings
font-synthesis
hyphenate-limit-chars
hyphenate-limit-last
hyphenate-limit-lines
hyphenate-limit-zone
interpret-as
line-break
object-fit
object-position
order
overflow-wrap
region-overflow
shape-image-threshold
shape-inside
shape-outside
text-combine
text-decoration-color
text-decoration-line
text-decoration-style
text-overflow
wrap
wrap-flow
wrap-margin
wrap-padding
wrap-through
writing-mode
The above list doesn't include any of the ~75 properties that are defined in CSS3 or CSS4 but are not supported by any browsers and (in some cases) are still under revision. A list of such properties is here if you do want to do anything with them:
https://gist.github.com/phanx/c0c9f9f0ee8d3163bfcd