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

Add support for Kakoune Script #5058

Merged
merged 4 commits into from Jul 19, 2021
Merged

Conversation

lenormf
Copy link
Contributor

@lenormf lenormf commented Oct 21, 2020

Description

This PR adds basic highlighting support for the scripting language interpreted by the Kakoune editor.

Checklist:

@lenormf lenormf force-pushed the support-kakscript branch 2 times, most recently from d1656dd to 327292c Compare Oct 21, 2020
@lildude lildude requested review from pchaigno and Alhadis Oct 26, 2020
@lildude
Copy link
Member

@lildude lildude commented Nov 3, 2020

Overall usage of the .kak extension currently falls just short of the minimum requirement so we can't merge this PR just yet, though it's not far off at about 180 unique user/repo combos.

However the kakrc and kakrc.local filenames is far from popular enough with only 182 of the former and zero of the latter. Thus the filenames section would also need to be removed before this could be merged or a sudden growth in usage would need to occur.

@occivink
Copy link

@occivink occivink commented Nov 3, 2020

How far off is it? I cannot find any documented popularity requirement for extensions and filenames.

@lildude
Copy link
Member

@lildude lildude commented Nov 3, 2020

From https://github.com/github/linguist/blob/master/CONTRIBUTING.md#adding-a-language

We try only to add languages once they have some usage on GitHub. In most cases we prefer that each new file extension be in use in hundreds of repositories before supporting them in Linguist.

"hundreds" is vague but we go on at least 200 unique user/repo combos. The same thing applies to filenames.

@lenormf
Copy link
Contributor Author

@lenormf lenormf commented Nov 4, 2020

I don't understand why the filenames would have to be removed. kakrc and kakrc.local contain the same language stored in .kak files, and are known to/read by the editor itself.

Why would a user's ability to read a highlighted kakrc file be predicated on how many .kak files others have uploaded to Github?

@lildude
Copy link
Member

@lildude lildude commented Nov 4, 2020

I don't understand why the filenames would have to be removed. kakrc and kakrc.local contain the same language stored in .kak files, and are known to/read by the editor itself.

Why would a user's ability to read a highlighted kakrc file be predicated on how many .kak files others have uploaded to Github?

They might be written in the same language, however a filename search for each returns far too few results for inclusion right now:

The lack of kakrc.local files entirely suggests people aren't storing these files on GitHub at all so support isn't warranted at this stage. Samples of these files weren't included in the PR either, which is required, but I didn't mention this because the lack of popularity makes the point moot.

@lenormf
Copy link
Contributor Author

@lenormf lenormf commented Nov 4, 2020

Sorry, this is still perplexing.

There are 4259 files with the .kak extension.

There are 517 kakrc files.

They both contain the exact same language — that's why there's no sample for kakrc files.

Why does the amount of either files, discriminated by their extension or lack thereof, matter? Both number of files should count towards the same metric: whether a language is being used on Github or not.

I guess I could remove kakrc.local, but it wouldn't make sense because either this file uniquely known for containing KakScript is supported along with all other files that are also known for containing KakScript, or it's not — users shouldn't have to wonder why kakrc.kak is being highlighted, but not kakrc, even though the naming of the latter is significant.

Finally, Linguist supporst .exrc extensions for Vim, despite Github hosting a grand total of 39 of such files. So I'm assuming that this low amount of files counted towards the total amount of Vim files, which is a reasonable rule that should apply here as well.

@lildude
Copy link
Member

@lildude lildude commented Nov 4, 2020

Why does the amount of either files, discriminated by their extension or lack thereof, matter? Both number of files should count towards the same metric: whether a language is being used on Github or not.

That's the point, the number of files does not count. It's the number of unique user/repos that count. If the number of files were the determining factor, anyone could qualify adding support for their new language based off a single repo with ten thousand files in it, or ten repos with a thousand files each, which wouldn't qualify as wide spread usage. As with many things, there are ways to game the system, but that's not really in the spirit of things.

I only called out the specific number files for the named files because their number alone would indicate there aren't enough unique user/repos containing the files in question, assuming a user would have at least one copy of the file per repo.

They both contain the exact same language — that's why there's no sample for kakrc files.

We still like to have samples to train the classifier so it can hopefully identify files that aren't explicitly identified by name or extension based on the content. The classifier is limited by the quality of the samples so the more representative of a language and usage the samples are, the better the chances of the classifier getting it right.

Finally, Linguist supporst .exrc extensions for Vim, despite Github hosting a grand total of 39 of such files. So I'm assuming that this low amount of files counted towards the total amount of Vim files, which is a reasonable rule that should apply here as well.

Linguist supports the .exrc filename, not extension:

Vim script:
type: programming
color: "#199f4b"
tm_scope: source.viml
aliases:
- vim
- viml
- nvim
extensions:
- ".vim"
- ".vba"
- ".vmb"
filenames:
- ".exrc"
- ".gvimrc"
- ".nvimrc"
- ".vimrc"
- _vimrc
- gvimrc
- nvimrc
- vimrc
ace_mode: text
language_id: 388

You'll see the files in your search results have not been associated with any language nor are they highlighted due to the lack of support for the .exrc extension.

Searching by filename returns 667 results spread across 263 unique user/repos so it meets the requirements.

That all said, as I mentioned before, you're almost there for adding support based on the .kak extension, hence I've added the "Pending Popularity" label. This is an indicator for the peeps to check the popularity every once in a while without risk of the PR going stale. If usage is growing rapidly, things could be ready for merging within a few weeks at most. If growth is slower, it could take a little longer.

Once usage is widespread enough, the PR can be merged and an override can be used for the kakrc and kakrc.local files if the classifier doesn't get it right. A new PR can be submitted to add each named file as their popularity increases.

@stale
Copy link

@stale stale bot commented Dec 25, 2020

This pull request has been automatically marked as stale because it has not had recent activity, and will be closed if no further activity occurs. If this pull request was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions.

@stale stale bot added the Stale label Dec 25, 2020
@lildude lildude removed the Stale label Jan 6, 2021
Copy link
Member

@lildude lildude left a comment

Good news @lenormf the .kak extension and kakrc files are now popular enough for inclusion in Linguist. 🎉 kakrc.local however isn't. 😞

Please merge the master branch into your branch and address my inline comments.

Thanks for your patience. 🙇

lib/linguist/languages.yml Show resolved Hide resolved
lib/linguist/languages.yml Outdated Show resolved Hide resolved
@lenormf lenormf requested a review from as a code owner Jun 9, 2021
@lenormf
Copy link
Contributor Author

@lenormf lenormf commented Jun 9, 2021

I've addressed the comments, and pushed the rebased branch. The new sample is a configuration file that I wrote, placed under the UNLICENSE.

@lenormf lenormf requested a review from lildude Jun 9, 2021
@lenormf
Copy link
Contributor Author

@lenormf lenormf commented Jul 1, 2021

PING

@lildude
Copy link
Member

@lildude lildude commented Jul 14, 2021

🤔 CI doesn't appear to have run on this PR at all. Could you grant me write access to your PR.

@lenormf
Copy link
Contributor Author

@lenormf lenormf commented Jul 14, 2021

It seems that you already have write access, according to Github (I also don't see any other menu that would allow me to tweak permissions):

2021-07-14-203106_1120x418_scrot

I edited the last commit and force pushed it to try to force CI to re-run, it doesn't look like it worked…

@lildude
Copy link
Member

@lildude lildude commented Jul 14, 2021

It seems that you already have write access, according to Github

🤔 are you sure? I can't see the button I'd normally see that allows me to merge master into your branch. Is "Allow edits and access to secrets by maintainers" in the sidebar checked? https://docs.github.com/en/github/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork has more info.

I edited the last commit and force pushed it to try to force CI to re-run, it doesn't look like it worked…

Try merging master into your branch. No need to rebase and/or force push as we don't care about commits as we squash when merging.

@lildude
Copy link
Member

@lildude lildude commented Jul 14, 2021

Oh wait. I can't see the update button but I can now see the approve CI button I couldn't see before.

@lildude lildude merged commit ec1b829 into github:master Jul 19, 2021
6 checks passed
kalkin added a commit to kalkin/file-expert that referenced this issue Sep 19, 2021
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.

None yet

3 participants