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) remove very old keywords and update example code #2623

Merged
merged 3 commits into from
Jul 2, 2020

Conversation

kageru
Copy link
Contributor

@kageru kageru commented Jul 1, 2020

These aren’t valid Kotlin keywords and just cause issues with autodetection
because Scala, which is syntactically quite similar to kotlin, actually has a trait keyword.
It even says // to be deleted soon, whenever soon is, so I decided to do it now.

Also replace trait in the example
(which would no longer be highlighted)
and format the code according to the Kotlin coding conventions.

kageru added 2 commits July 1, 2020 15:43
There aren’t valid Kotlin keywords.
Also remove the `trait` usage from the example and format the code
according to the Kotlin coding conventions.
@joshgoebel
Copy link
Member

joshgoebel commented Jul 2, 2020

Your removing 5 different keywords here, not just trait. Do you know when they were they removed from the Kotlin language? We don't have a specific policy on handling deprecations like this but in general if code still exists using these things we'd like to still be highlighting them - so we've never been in a hurry to remove older keywords.

Auto-detect is never guaranteed and not a justification in and of itself for removing older keywords.

@kageru
Copy link
Contributor Author

kageru commented Jul 2, 2020

As far as I know, none of these were ever valid keywords. I don’t know why they’re in the syntax definition to begin with.
trait is a keyword from Scala, and the other four are Java keywords.

They’re nowhere to be found in the list of keywords in the Kotlin language documentation.

@joshgoebel
Copy link
Member

https://stackoverflow.com/questions/46757825/does-kotlin-have-a-trait-type

Trait most definitely was. Though I'm happy to say 5 years was "some time ago though"... I wonder about the other keywords. Would be nice to have a Kotlin person weigh in on this.

If the problem that let you here is truly just relevancy though how about updating the comment to "old syntax" and simply making them all 0 relevancy? Are they harming current highlighting of Kotlin code?

@joshgoebel
Copy link
Member

joshgoebel commented Jul 2, 2020

Ok let me review this again. I think we can put some weigh into Sannis's comment 4 years ago: "delete soon". af601cb

So lets go ahead and remove them. :)

@kageru
Copy link
Contributor Author

kageru commented Jul 2, 2020

I don’t think they harm anything. The reason I removed them was because I saw the example on the hljs website using trait. We can keep the wrong keywords, but then I’d at least change the example to avoid future confusion.

@joshgoebel
Copy link
Member

Can you please also add an entry to CHANGES.md?

@kageru
Copy link
Contributor Author

kageru commented Jul 2, 2020

I’ll do that.

@joshgoebel
Copy link
Member

The reason I removed them was because I saw the example on the hljs website using trait.

Ah I forget we use the detect samples as sample code for the website.

@joshgoebel
Copy link
Member

@kageru Thanks for spotting!

@joshgoebel joshgoebel changed the title Remove incorrect Kotlin keywords (kotlin) remove very old keywords and update example code Jul 2, 2020
@joshgoebel joshgoebel added enhancement An enhancement or new feature language labels Jul 2, 2020
@joshgoebel joshgoebel merged commit 465c2fe into highlightjs:master Jul 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature language
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants