Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

toh995
Copy link
Contributor

@toh995 toh995 commented Apr 6, 2025

Description

Add support for koka.

Checklist:

@toh995 toh995 marked this pull request as ready for review April 6, 2025 20:13
@toh995 toh995 requested a review from a team as a code owner April 6, 2025 20:13
@TimWhiting
Copy link

TimWhiting commented Apr 7, 2025

@toh995 I don't think .core is a Koka extension. .kkc is probably what you are thinking of.

.kk is source
.kkc is core (a subset of source), highlights pretty well with the textmate grammar, but might also have some features less supported - it is a generated intermediate file representation, probably not ever checked into git.
.kki is interface files, always generated as an interface for distributing binary libraries, and linking to them. Also just a subset of the source syntax, and highlights mostly fine with the textmate grammar.

@toh995 toh995 marked this pull request as draft April 7, 2025 01:17
@toh995
Copy link
Contributor Author

toh995 commented Apr 7, 2025

Hi @TimWhiting. Thanks for the advice.

I was going off of this part of the textmate grammar: https://github.com/koka-lang/koka/blob/e55036d/support/vscode/koka.language-koka/syntaxes/koka.json#L3

I had thought that there was a one-to-one mapping between file extensions vs. file types. But looks like that is not actually the case?

Which file extensions would you recommend adding linguist support for, amongst the three? Obviously we'd like .kk support, but what about the others?

EDIT: Maybe we can add .kk only for now, since I only provided code samples for .kk.

@TimWhiting
Copy link

I've made a change in the original textmate grammar in the Koka repo to reflect the actual file type.

I'd say add all of the extensions unless there is any concern from the linguist side. They all should be highlighted using this grammar if they show up in a repository or on github issues. We probably should add examples of those files though.

@lildude
Copy link
Member

lildude commented Apr 7, 2025

I'd say add all of the extensions unless there is any concern from the linguist side.

All extensions need to meet our usage requirements. Any that don't will hold back the PR from being merged. Once merged and deployed, users can use an override to set the language for the less poor extensions.

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

Several of your samples are too big… if the diff suppresses them, they're too big for our needs. Please remove or replace the large samples. We don't need many, just a few most representative of real usage of the language.

@toh995
Copy link
Contributor Author

toh995 commented Apr 7, 2025

Thanks @lildude for weighing in RE: file extensions!

Looks like .kki and .kkc clearly do not meet the usage requirements. I'll remove those file extensions from this PR.

@toh995 toh995 marked this pull request as ready for review April 7, 2025 07:59
@toh995
Copy link
Contributor Author

toh995 commented Apr 7, 2025

@lildude I've addressed your comments! I'd appreciate another round of review.

Also - another question - how is the grammar git submodule kept up-to-date? i.e. suppose the upstream grammar repo gets updated (e.g. in our case, koka-community/koka-textmate-grammar). How does linguist pick up on these upstream changes? Do we need to manually update linguist for every upstream change?

@TimWhiting
Copy link

@toh995 It looks like most languages only have one sample per extension, it looks like multiple samples are not necessary unless there are other languages with the same extension to disambiguate which actual language it better matches. Since no other language uses .kk I think we only need one sample.

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

Since no other language uses .kk I think we only need one sample.

As suggested, we don't need this many samples. Adding two or three now will ensure we have sufficient samples if a new language is added with a matching extension.

@toh995
Copy link
Contributor Author

toh995 commented Apr 7, 2025

Thanks @lildude for the review!

For the code samples, is it okay if it doesn't contain all possible language features? I guess that's why I added so many samples, I wanted to ensure we get reasonable coverage of all language features 😅

@TimWhiting
Copy link

@toh995 I don't think we need all features, just enough to distinguish from another language using the .kk extension.

From looking at the other languages in the samples folder it seems like there is a wide variety of lengths and numbers of samples, and many have only one or two samples per extension type. For example, Kotlin, Dart, ReScript and Scala have very few samples (1-2). There are others that have a lot (Swift). I feel like the ones that have a lot are going overboard. What other programming language is going to use the .swift extension? Also the samples don't necessarily need to be a full module with tests and main functions. Maybe some different examples of omitting {} and ; versus using {} and ; could be useful. I don't think it has to be comprehensive. If another language decides to use .kk, then they will have to add enough samples to distinguish from Koka's syntax, which is unlikely to be hard - since Koka has some unique features and keywords.

@toh995
Copy link
Contributor Author

toh995 commented Apr 12, 2025

@lildude I believe this is ready for re-review

Copy link
Member

@lildude lildude left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

Important

The changes in this PR will not appear on GitHub until the next release has been made and deployed. See here for more details.

@lildude lildude added this pull request to the merge queue Apr 20, 2025
Merged via the queue into github-linguist:main with commit e6afccc Apr 20, 2025
5 checks passed
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Aug 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants