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

GitHub syntax highlighting for Spack specs #22615

Open
adamjstewart opened this issue Mar 29, 2021 · 2 comments
Open

GitHub syntax highlighting for Spack specs #22615

adamjstewart opened this issue Mar 29, 2021 · 2 comments

Comments

@adamjstewart
Copy link
Member

adamjstewart commented Mar 29, 2021

It would be awesome if we could add GitHub syntax highlighting support for Spack specs.

Rationale

Right now, if I share a Spack spec on GitHub, it looks like:

python@3.8.8%apple-clang@12.0.0+bz2+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl~tix~tkinter~ucs4+uuid+zlib patches=0d98e93189bc278fbc37a50ed7f183bd8aaf249a8e1670a465f0db6bb4f8cf87 arch=darwin-catalina-x86_64
    ^apple-libuuid@1353.100.2%apple-clang@12.0.0 arch=darwin-catalina-x86_64
    ^bzip2@1.0.8%apple-clang@12.0.0+shared arch=darwin-catalina-x86_64
        ^diffutils@3.7%apple-clang@12.0.0 arch=darwin-catalina-x86_64
            ^libiconv@1.16%apple-clang@12.0.0 arch=darwin-catalina-x86_64
    ^expat@2.2.10%apple-clang@12.0.0~libbsd arch=darwin-catalina-x86_64
    ^gdbm@1.19%apple-clang@12.0.0 arch=darwin-catalina-x86_64
        ^readline@8.0%apple-clang@12.0.0 arch=darwin-catalina-x86_64
            ^ncurses@6.2%apple-clang@12.0.0~symlinks+termlib arch=darwin-catalina-x86_64
                ^pkgconf@1.7.3%apple-clang@12.0.0 arch=darwin-catalina-x86_64
    ^gettext@0.21%apple-clang@12.0.0+bzip2+curses+git~libunistring+libxml2+tar+xz arch=darwin-catalina-x86_64
        ^libxml2@2.9.10%apple-clang@12.0.0~python arch=darwin-catalina-x86_64
            ^xz@5.2.5%apple-clang@12.0.0~pic arch=darwin-catalina-x86_64
            ^zlib@1.2.11%apple-clang@12.0.0+optimize+pic+shared arch=darwin-catalina-x86_64
        ^tar@1.32%apple-clang@12.0.0 arch=darwin-catalina-x86_64
    ^libffi@3.3%apple-clang@12.0.0 patches=26f26c6f29a7ce9bf370ad3ab2610f99365b4bdd7b82e7c31df41a3370d685c0 arch=darwin-catalina-x86_64
    ^openssl@1.1.1k%apple-clang@12.0.0~docs+systemcerts arch=darwin-catalina-x86_64
        ^perl@5.32.1%apple-clang@12.0.0+cpanm+shared+threads arch=darwin-catalina-x86_64
            ^berkeley-db@18.1.40%apple-clang@12.0.0~docs patches=b231fcc4d5cff05e5c3a4814f6a5af0e9a966428dc2176540d2c05aff41de522 arch=darwin-catalina-x86_64
    ^sqlite@3.34.0%apple-clang@12.0.0+column_metadata+fts~functions~rtree arch=darwin-catalina-x86_64

It would be much easier to read if it looked like:

Screen Shot 2021-03-29 at 11 17 33 AM

Description

Ideally, users would be able to do something like:

```spack
...
```

Additional information

It looks like being able to specify a custom repo-specific language is a common feature request:

So far, GitHub doesn't seem interested in supporting this. One possible solution would be to submit a PR to https://github.com/github/linguist to add support for Spack spec syntax highlighting. I'm not sure if they'll allow this, since Spack's specs aren't exactly a "programming language", but it's worth a shot.

Here are the instructions for adding support for a new language: https://github.com/github/linguist/blob/master/CONTRIBUTING.md#adding-a-language

It looks like they require a "language" to be popular on GitHub (at least 200 repos use it). Not sure if we can count repos with spack.yaml files since that's really just a YAML file, not a Spack spec syntax, but we have plenty of those: https://github.com/search?q=filename%3Aspack.yaml&type=Code

Pinging some main contributors to linguist to see if they have any thoughts on this: @josh @arfon @pchaigno @tnm @Alhadis. If you instead want me to open an issue on https://github.com/github/linguist for discussion let me know.

@haampie
Copy link
Member

haampie commented Mar 29, 2021

See https://github.com/haampie/spack-spec-highlight-vscode for highlighting in vscode, maybe that can be reused. I'm not familiar with linguist

@adamjstewart
Copy link
Member Author

@alalazo alalazo added this to the v0.20.0 milestone Jan 26, 2023
@alalazo alalazo removed this from the v0.20.0 milestone May 3, 2023
@alalazo alalazo added the revisit label May 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants