-
Notifications
You must be signed in to change notification settings - Fork 264
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
Update lexers #1133
Update lexers #1133
Conversation
Very hesitant +1 from me. Shouldn’t we first make some vivisection like what I suggested in https://paste.sr.ht/~mcepl/ef4aba41df3c516bc6a96ed1ee9643fed78e01d0 (and orbitalquark/scintillua#99 (comment)) so that at least we have something half-functional? |
So right now any styles added with
Which out of ~150 lexers isn't bad. You can still get styling for all Lines 132 to 144 in d37a20c
So I don't really think this is half functional as you say. |
Yes, “half functional” is too harsh, but what I meant is that current state of that branch is a regression against the previous released version. |
cbea2a9
to
b753520
Compare
@rnpnr I think there's a |
lua/themes/dark-16.lua
Outdated
lexers.STYLE_TARGET = '' | ||
|
||
-- Markdown | ||
lexers.STYLE_HR = '' |
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.
The markdown theming example is missing:
STYLE_BOLD
STYLE_ITALIC
STYLE_LIST
STYLE_LINK
STYLE_REFERENCE
STYLE_HEADING_H1
-STYLE_HEADING_H6
Here is what I use in my theme:
lexers.STYLE_BOLD = 'fore:default,back:default,bold'
lexers.STYLE_ITALIC = 'fore:default,back:default,italics'
lexers.STYLE_LIST = lexers.STYLE_KEYWORD
lexers.STYLE_LINK = lexers.STYLE_KEYWORD
lexers.STYLE_REFERENCE = lexers.STYLE_KEYWORD
lexers.STYLE_HR = 'fore:red'
for i=1, 6 do lexers['STYLE_HEADING_H'..i] = 'fore:red' end
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.
Thanks! The STYLE_HEADING_H?
are already in the txt2tags
example but I can add your line to both. As for the others I missed them since they were defined elsewhere in the scintillua themes. They are also used in a couple other lexers so it might be useful to just define them by default.
By the way stuff like:
lexers.STYLE_BOLD = 'fore:default,back:default,bold'
is equivalent to:
lexers.STYLE_BOLD = 'bold'
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.
Oops the txt2tags
is STYLE_H?
(which from what I see in the lexer is never actually used). Either way both can be replaced by the for
loop.
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.
Oops the
txt2tags
isSTYLE_H?
(which from what I see in the lexer is never actually used). Either way both can be replaced by thefor
loop.
It is actually used at:
Line 24 in b753520
return token('h' .. level, equal + plus) * header_label^-1 |
I have not confirmed it but looking at the code the tokens h1
up to h6
are defined.
Good catch, I will fix it. |
Do people think that the commented out examples should just be enabled by default? It would result in some small amount of extra runtime memory usage but should make it so this patchset doesn't remove the working existing styles. |
I don't really care, because I use my own theme definitions. |
That +1 was for this, not for the first sentence. |
Sounds good to me. In that case here is an idea: combine As for the |
Sounds a like a sound plan ;). |
You made a huge amount of work with reviving those themes. Respect and thank you! Applied to my We should also collect what changes (if any) we want to push upstream and somehow resolve orbitalquark/scintillua#99. |
Actually everything here is upstream besides your change to search in the correct path.
Unfortunately I don't have any knowledge of reST so I don't know which
I'm still working on this btw. There are some bugs in the logic for applying themes which is probably why no one else has attempted to merge the styles. Work in progress is in my |
I think I'm going to cherry-pick the following commits into master: |
On Tue Dec 5, 2023 at 8:25 PM CET, Randy Palamar wrote:
I think I'm going to cherry-pick the following commits into master:
[lua: drop redrawtime option](26b59c9)
[lua: filetype: use alt_name field to alias to other lexers](33f6826)
These are strictly bugfixes and shouldn't be contentious.
Certainly, go for it!
|
Rather than cherry pick patches from after 6.2 we will just grab everything as is.
Based on the advice from the upstream maintainer of Scintillua (gh#orbitalquark/scintillua#87).
vis{,-std}.lua: * replace removed _TOKENSTYLES with _TAGS * don't add default styles to the lexer. lexers no longer define their own styles filetype.lua: update path detection for scintillua 6.2
Caching lexers causes lexer tables to be constructed once and reused during each HIGHLIGHT event. Additionally it allows to modify the lexer used for syntax highlighting from Lua code. This is used for example for the syntax aware spellchecking performed by the vis-spellcheck plugin.
This also involves modifying the style definitions so that they include sub tags as well. For example command.section in latex should be mapped to COMMAND_SECTION.
On Wed Mar 27, 2024 at 1:06 PM CET, Randy Palamar wrote:
Merged #1133 into master.
Thank you!
Matěj
P.S.: So, now only to merge tests, right? ;)
--
http://matej.ceplovi.cz/blog/, @***@***.***
GPG Finger: 3C76 A027 CA45 AD70 98B5 BC1D 7920 5802 880B C9D8
If only there were evil people somewhere insidiously committing
evil deeds, and it were necessary only to separate them from the
rest of us and destroy them. But the line dividing good and evil
cuts through the heart of every human being. And who is willing
to destroy a piece of his own heart?
-- Aleksandr Solzhenitsyn: The Gulag Archipelago
|
This should be just about ready to merge now. One thing I'm still not
sure about is the modifying of the default styles. I don't think it is
necessary to bloat up the lexers table with all the possible style tags
but there should still be some way of indicating to users how they can
add styles for missing tags. Let me know if someone has a better idea
than just copying from upstream and leaving them commented out.
As indicated by the commit authors this contains the work of a few
different people whom I pass on my thanks!