-
Notifications
You must be signed in to change notification settings - Fork 237
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
Changing color of Characters like "{","}","(",")",";" etc. #93
Comments
Hello, you can change the styling of these characters/strings the same way you set the style of any other word. If you started with the JavaKeywords example of using regular expressions, my comments in #62 show how to extends this to multiple styles (i.e. multiple regexes, each meaning a different style). As your use case gets more complicated, a proper parser for your language becomes more and more justified. Then string literals, comments, braces, parens, punctuation, etc. are all just different kinds of lexical elements recognized by your grammar. The parser gives you index ranges of these elements in text and you can use these ranges to assign styles in the text area (e.g. CodeArea). You might be interested in @jrguenther's project Xanthic to hook up CodeArea with an ANTLR parser. |
My apologies for commenting on a closed issue. For Coloring the code can we use /usr/share/gtksourceview-3.0/language-specs/* (from ubuntu 14.04) files in RichTextFX in some way? I was just wondering if there is anyway to implement these, this may save a lot of programming & development time. This will be good if RichTextFx includes support for all coding styles by default and formatting option by default (Just a request). :) |
@deepsidhu1313, I don't think @TomasMikula has any plans to add this kind of support. You really should check out jrguenther/Xanthic. I haven't had time to take it any further, but all the pieces are there to provide syntax highlighting. The source should be fairly straightforward. Right now, all you need to do is create a parser for your language and setup the mapping between token and style. It might be less work than you think to get started. Pull requests are very much welcome. |
@jrguenther Sir, i am following your project from long time, i tried once understanding your project, but my bad, i have very less experience with parsers or compilers or ANTLR. Also i imported your code into netbeans and it says these classes are missing. import xanthic.parsers.ShiroLexer; I waited long for you to add these files and keep checking the last edit date on your project which remained unchanged :). So may i request you to please provide any documentation with your project so that i can contribute to it. In my project code editor is at its least priority and not a main feature. I just want to make the application beautiful. BTW good work and keep it up. :) 👍 |
@jrguenther is right that I don't plan to add any tool/language/grammar specific support to this project. To quote my comment from #104:
And further:
I had a quick look at GtkSourceView and it is a C library, so it would make sense to first find/write a Java port of it's parser part and then use both that project and RichTextFX to build an editor. |
Thanks :) 👍 |
is there anyway i can change the color of Characters like "{","}","(",")",";" etc. and strings starts and ends with (") also line starts with (//) or where strings starts with ("/star") and end with ("star/") to theme my code area ??
The text was updated successfully, but these errors were encountered: