Skip to content
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

Syntax coloring for .kt files #1228

Merged
merged 6 commits into from
May 3, 2019

Conversation

JaroslavTulach
Copy link

Last week I had a presentation in Ostrava. The second speaker, Leoš, was talking about Kotlin. Hence I decided to demonstrate native image with the sieve of Eratosthenes written in Kotlin.

I had to write a NetBeans module that provides syntax coloring for the .kt files. Here is the code that I have. If OK, I'd like to push it to master branch.

@GeertjanWielenga
Copy link

Excellent.

@JaroslavTulach
Copy link
Author

JaroslavTulach commented May 2, 2019

This PR can serve as an example how to integrate syntax coloring for any language into NetBeans:

  1. find the TextMate grammar somewhere (mine is from kotlin-sublime-package project, ASF 2.0 licensed, so OK, right @matthiasblaesing?)
  2. use the FileType wizard to generate DataObject representing the file in editor
  3. use @GrammarRegistration annotation to connect the two
  4. prepare a new file template processed by freemarker

Copy link
Member

@geertjanw geertjanw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great.

@Chris2011
Copy link
Contributor

Cool. I did it similar in my repo: https://github.com/Chris2011/TextmateBeans. Didn't know that a @GrammarRegistratrion exists, but I see, only for the NetBeans core, not usable for 3rd-party-plugins.

I had a look into the code and it looks straight forward :)

@jtulach
Copy link
Contributor

jtulach commented May 2, 2019

Re. TextMateBeans - wouldn't it be better to donate all of that to Apache? Then I wouldn't have to bother with Kotlin (only Kotlin) myself!

@Chris2011
Copy link
Contributor

Yes but first, I had an other intention to create such plugin, for this we can talk in private :) and second not all of that languages are working as expected. I created 4 tickets in case of problem with the textmate lexer. But also another topic.

@JaroslavTulach
Copy link
Author

... I had an other intention to create such plugin...

OK, I'll integrate my changes then. If you even consider contributing to Apache NetBeans, you can modify my commits.

@JaroslavTulach JaroslavTulach merged commit e9ecefd into apache:master May 3, 2019
@JaroslavTulach JaroslavTulach deleted the jtulach/KotlinColoring branch May 3, 2019 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants