Closed generalmimon closed 3 years ago
Interesting. Does it do any harm to leave those set?
@brunchboy:
Interesting. Does it do any harm to leave those set?
It wouldn't harm anything if the linguist-language
value would match an existing name in the languages.yml
file. However, you call it KaitaiStruct
, but it is registered under the name Kaitai Struct
in the languages.yml
file:
Kaitai Struct:
type: programming
aliases:
- ksy
ace_mode: yaml
# ...
And for language names with spaces in them, the Linguist docs (docs/overrides.md#using-gitattributes
) advise this:
# Replace any whitespace in the language name with hyphens: *.glyphs linguist-language=OpenStep-Property-List
In short, you would need to change this
into
*.ksy linguist-language=Kaitai-Struct
Also, I'm not 100% sure if the line
would work as intended; in the Linguist docs, the linguist-detectable
attribute is just included without any value (docs/overrides.md#detectable
):
Use the
linguist-detectable
attribute to mark or unmark paths as detectable:*.kicad_pcb linguist-detectable *.sch linguist-detectable tools/export_bom.py -linguist-detectable
So just to make sure it will work, I'd recommend the official approach.
Also, the basic feature of the .gitattributes file is the support of multiple attributes per path pattern, see https://git-scm.com/docs/gitattributes#_description:
A
gitattributes
file is a simple text file that givesattributes
to pathnames.Each line in
gitattributes
file is of form:pattern attr1 attr2 ...
so you can easily merge the two attributes linguist-{language,detectable}
into one line:
*.ksy linguist-language=Kaitai-Struct linguist-detectable
I see! Thank you for the very detailed explanation.
Since GitHub recognizes the
.ksy
file extension out of the box (https://github.com/github/linguist/pull/4830), it is no longer needed to specify the language in.gitattributes
manually.