-
Notifications
You must be signed in to change notification settings - Fork 32
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
Feature: Support code language highlighting #18
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lytefast
force-pushed
the
code-language-syntax
branch
12 times, most recently
from
October 24, 2020 09:58
f723261
to
cbd2474
Compare
lytefast
force-pushed
the
code-language-syntax
branch
2 times, most recently
from
October 25, 2020 00:18
76f5ff9
to
9671e14
Compare
lytefast
force-pushed
the
code-language-syntax
branch
5 times, most recently
from
October 26, 2020 19:57
5c87693
to
11691d8
Compare
lytefast
commented
Oct 26, 2020
@@ -22,4 +20,18 @@ open class Node<R> { | |||
} | |||
|
|||
open fun render(builder: SpannableStringBuilder, renderContext: R) {} |
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.
I was tempted to change the render function here to do what Parent
does, but didn't know if that would conflict with any downstream types.
lytefast
force-pushed
the
code-language-syntax
branch
3 times, most recently
from
October 31, 2020 01:55
161e2b3
to
5918d34
Compare
AndyG
reviewed
Nov 3, 2020
simpleast-core/src/test/java/com/discord/simpleast/core/ParserTest.java
Outdated
Show resolved
Hide resolved
lytefast
force-pushed
the
code-language-syntax
branch
from
November 3, 2020 00:25
5918d34
to
99f6b20
Compare
lytefast
commented
Nov 3, 2020
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.
lytefast
force-pushed
the
code-language-syntax
branch
3 times, most recently
from
November 3, 2020 02:57
202ad11
to
09caf3a
Compare
- update sample to render code and use block code node - use styles to for rendercontext instead of just color int
…ting a single group
lytefast
force-pushed
the
code-language-syntax
branch
from
November 4, 2020 19:04
09caf3a
to
b32638f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds support to highlight code for
Kotlin, Python, Rust, XML, ProtoBuff
. Kotlin has some additional support, but it wouldn't be hard to add it for other languages too.Feature
New
CodeRule + CodeNode
added to the library.CodeNode
does a bit of span-fu, see inlined documentation. Basically it makes sure that styles applied by theCodeNode
apply first, then the child styles are applied. This prevents theCodeNode
styles from overwriting the styles of the children.CodeStyleProviders
which provides it a way of creating styled spannables for the different values. This is how we can configure the styling in the client to use whatever styles we want.Eventually this should support Textmate language extensions
Adding new language:
Adding simple support for new languages can be done by defining 3 things:
Example of adding a language:
Additional changes
-New StyleNode.Text for a bit more optimized
Node
structure used for CodeNodeBlockBackgroundNode
similar to what we have in discord to the sample appScreens