github-linguist / linguist

Language Savant. If your repository's language is being reported incorrectly, send us a pull request!
MIT License
12.14k stars 4.2k forks source link

J# language #4124

Closed kspalaiologos closed 6 years ago

kspalaiologos commented 6 years ago

Although J# is not-so-commonly used, it's still an language. A few repositories:

I couldn't find more because it's really hard.

Preliminary Steps

Please confirm you have...

Problem Description

URL of the affected repository:

As mentioned earlier, https://github.com/matt77hias/jsl-smallpt & https://github.com/ankurdave/htw-3d

Last modified on:

2017-24-24, 2016-3-14

Expected language:

J#

Detected language:

None & "logos"

pchaigno commented 6 years ago

Are there other languages that you know of using the .jsl extension? Are there files in this search query that are not J#?

kspalaiologos commented 6 years ago

Yes, some kind of shader language. It's different from J# and is C-Like, while J# has syntax like C#+Java.

pchaigno commented 6 years ago

Then we'll first need to estimate the number of .jsl files on Github for these two languages. Could you point me to a couple of these C-like files?

kspalaiologos commented 6 years ago

Every file inside https://github.com/ojdkbuild/upstream_openjfx is written in C-like shader language.

1) https://github.com/ojdkbuild/upstream_openjfx/blob/2ccffe1ac8dfde4ccc819f5b4d189c0185823c85/modules/javafx.graphics/src/main/jsl-decora/Blend.jsl

2) https://github.com/ojdkbuild/upstream_openjfx/blob/2ccffe1ac8dfde4ccc819f5b4d189c0185823c85/modules/javafx.graphics/src/main/jsl-decora/Blend_ADD.jsl

3) https://github.com/ojdkbuild/upstream_openjfx/blob/2ccffe1ac8dfde4ccc819f5b4d189c0185823c85/modules/javafx.graphics/src/main/jsl-decora/Blend_BLUE.jsl

4) https://github.com/ojdkbuild/upstream_openjfx/blob/2ccffe1ac8dfde4ccc819f5b4d189c0185823c85/modules/javafx.graphics/src/main/jsl-decora/Blend_COLOR_BURN.jsl

kspalaiologos commented 6 years ago

From my observatons, this files contain not-OO code, so I think it's possible to just search for C#+Java like only tokens.

If it's needed, I can hand some samples and release them to public domain

pchaigno commented 6 years ago

@KrzysztofSzewczyk Using the extension:jsl float4 OR param search query and Harvester, I count only 48 repositories by 42 users. That's not enough to warrant support in Linguist, so we won't need to add this language.

For J#, Harvester finds 398 repositories by 366 in the 2156 files I downloaded from the extension:jsl class OR private OR public OR package search query. That's enough to warrant support in Linguist. We'll gladly accept a pull request to add that language :smiley:

kspalaiologos commented 6 years ago

In which format should I provide grammar for language?

pchaigno commented 6 years ago

Linguist (and GitHub.com) support Sublime Text, Atom, or TextMate grammars.

kspalaiologos commented 6 years ago

Syntax is actually same as C# (some exceptions are present, tho), so where should I look for eg. C#/Java grammars?

pchaigno commented 6 years ago

Those we already use should be fine: https://github.com/github/linguist/tree/master/vendor.

kspalaiologos commented 6 years ago

I ran to some kind of strange problem:

$ script/add-grammar https://github.com/KrzysztofSzewczyk/JSharpSyntax.git
Command failed. Aborting.
Registering new submodule: vendor/grammars/JSharpSyntax
$ git submodule add -f https://github.com/KrzysztofSzewczyk/JSharpSyntax vendor/grammars/JSharpSyntax
  > Cloning into 'C:/Users/PC/Desktop/linguist/vendor/grammars/JSharpSyntax'...
  > fatal: clone of 'https://github.com/KrzysztofSzewczyk/JSharpSyntax' into submodule path 'C:/Users/PC/Desktop/linguist/vendor/grammars/JSharpSyntax' failed

Propably I'm missing something. When I'll remove ".git" it doesn't work too.

pchaigno commented 6 years ago

Do you really need to add a new grammar? If you're not going to change the syntax, couldn't you reuse the one we use for Java or for C#?

kspalaiologos commented 6 years ago

@pchaigno I can use C# grammar, but the syntax highlighting won't be 100% accurate. How do I reuse C# grammar?

pchaigno commented 6 years ago

I'm asking because it looked like you were simply reusing the Java grammar. To use any grammar already used by another language, you can just fill out tm_scope: scope_of_that_grammar (e.g., tm_scope: source.java) in your languages.yml entry.

kspalaiologos commented 6 years ago

OK, I've done it. script/set-language-ids fails somehow (I couldnt find any depedency-installing script). The error is: "Could not find gem 'rake-compiler (~> 0.9) x64-mingw32' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)" I've already tried gem install rake-compiler, without luck. I'm total newbie in Ruby, so please forgive me if it's stupid question.

pchaigno commented 6 years ago

@KrzysztofSzewczyk Did you make progress on this? I'm sorry I can't be of much help for the above problem, I've never installed Linguist on Windows.

kspalaiologos commented 6 years ago

I got a stuck there, couldn't find help from friends programming in Ruby, then I forgot about it. Now I have Linux machine so I'm going to test it out

kspalaiologos commented 6 years ago

Screenshot I have problem with update-ids once again, it assigns some meaningless number to language...

pchaigno commented 6 years ago

That's how it's supposed to work. As long as it only adds an id to J#, it should be alright.

kspalaiologos commented 6 years ago

So it's OK then? I mean, other languages have "normal" id's

pchaigno commented 6 years ago

Not all of them. It's okay.

kspalaiologos commented 6 years ago

PR was made, so I'm closing issue as it's not needed currently.