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

Kotlin: Fix highlighting plugin names for build.gradle.kts files #1323

Merged
merged 1 commit into from
Sep 10, 2019
Merged

Kotlin: Fix highlighting plugin names for build.gradle.kts files #1323

merged 1 commit into from
Sep 10, 2019

Conversation

lordcodes
Copy link
Contributor

@lordcodes lordcodes commented Sep 7, 2019

When using Gradle Kotlin DSL, the contents are Kotlin code. However, in this situation you may have an identifier that contains a dash, due to it referring to the name of a Gradle plugin.

Without this change it doesn't match at all and if the plugin name is wrapped in back-ticks it marks those as errors.

E.g.

plugins {
  `maven-publish-plugin`
}

Fixes #927
Fixes #1325

@pyrmont

@pyrmont pyrmont added the needs-review The PR needs to be reviewed label Sep 7, 2019
@pyrmont pyrmont self-assigned this Sep 7, 2019
Copy link
Contributor

@pyrmont pyrmont left a comment

Choose a reason for hiding this comment

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

Thanks for this PR, too :)

lib/rouge/lexers/kotlin.rb Outdated Show resolved Hide resolved
lib/rouge/lexers/kotlin.rb Outdated Show resolved Hide resolved
@pyrmont pyrmont added author-action The PR has been reviewed but action by the author is needed and removed needs-review The PR needs to be reviewed labels Sep 7, 2019
@pyrmont
Copy link
Contributor

pyrmont commented Sep 8, 2019

@lordcodes Did anything change with the force-pushed code? It didn't appear that it did but am not sure.

@lordcodes
Copy link
Contributor Author

lordcodes commented Sep 8, 2019 via email

@pyrmont
Copy link
Contributor

pyrmont commented Sep 8, 2019

@lordcodes No problem—understood!

@pyrmont pyrmont added dependent-pr The PR is dependent on other changes being merged and will be reviewed later. and removed dependent-pr The PR is dependent on other changes being merged and will be reviewed later. labels Sep 9, 2019
@lordcodes
Copy link
Contributor Author

lordcodes commented Sep 9, 2019

Changes are rebased on top of changes for #1326 so this PR should wait until that PR is merged first, so I can update this after that merge.

However, changes for this PR are complete and after #1326 are very simple. Just allowing - and _ within name/identifier regex. This is valid as matches with different naming conventions developers may use for properties/functions within their Kotlin code and also for Gradle Kotlin DSL files, where _ and - will be common.

@pyrmont pyrmont added dependent-pr The PR is dependent on other changes being merged and will be reviewed later. and removed dependent-pr The PR is dependent on other changes being merged and will be reviewed later. labels Sep 9, 2019
When using Gradle Kotlin DSL, the contents are Kotlin code. However, in
this situation you may have an identifier that contains a dash, due to
it referring to the name of a Gradle plugin.
@lordcodes
Copy link
Contributor Author

@pyrmont This PR is rebased onto latest master and is ready to go again!

@pyrmont pyrmont merged commit c227b37 into rouge-ruby:master Sep 10, 2019
@pyrmont
Copy link
Contributor

pyrmont commented Sep 10, 2019

@lordcodes And so ends this series of improvements to the Kotlin lexer. Thank you again! 🎉

@pyrmont pyrmont removed the author-action The PR has been reviewed but action by the author is needed label Sep 10, 2019
@lordcodes lordcodes deleted the kotlin-plugin-identifiers branch September 10, 2019 08:21
@lordcodes
Copy link
Contributor Author

@pyrmont Haha, thanks for your help getting them merged! Its been fun! Will make the code snippets look much better on my blog too 🎉

@pyrmont
Copy link
Contributor

pyrmont commented Sep 10, 2019

Yep, definitely. The best part of maintaining the project is collaborating with other people to improve the code. It's kind of crazy when you stop and think about all the infrastructure that allows that to happen—yay Internet! :)

@lordcodes
Copy link
Contributor Author

Couldn't agree more! 👍

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.

Hyphen support in Kotlin scripts Kotlin Script Support
2 participants