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

New language: d2 #6283

Closed
pablodz opened this issue Feb 12, 2023 · 8 comments
Closed

New language: d2 #6283

pablodz opened this issue Feb 12, 2023 · 8 comments
Labels
Add Language Good First Issue This is a great opportunity to start contributing to Linguist

Comments

@pablodz
Copy link

pablodz commented Feb 12, 2023

Language name

d2

URL of example repository

https://github.com/terrastruct/d2#what-does-d2-look-like

URL of syntax highlighting grammar

https://github.com/terrastruct/d2-vscode this vscode package includes syntax highlight

# Actors
hans: Hans Niemann

defendants: {
  mc: Magnus Carlsen
  playmagnus: Play Magnus Group
  chesscom: Chess.com
  naka: Hikaru Nakamura

  mc -> playmagnus: Owns majority
  playmagnus <-> chesscom: Merger talks
  chesscom -> naka: Sponsoring
}

# Accusations
hans -> defendants: 'sueing for $100M'

# Offense
defendants.naka -> hans: Accused of cheating on his stream
defendants.mc -> hans: Lost then withdrew with accusations
defendants.chesscom -> hans: 72 page report of cheating

Most popular extensions

.d2

Detected language

none

@pablodz pablodz added Add Language Good First Issue This is a great opportunity to start contributing to Linguist labels Feb 12, 2023
@blaggacao
Copy link

-> terrastruct/d2-vscode#91

I tried but I'm getting this error:

script/add-grammar https://github.com/terrastruct/d2-vscode
Checking Docker is installed and running
Registering new submodule: https://github.com/terrastruct/d2-vscode.git
Reactivating local git directory for submodule 'vendor/grammars/d2-vscode'
latest: Pulling from linguist/grammar-compiler
Digest: sha256:fcaf08a6e27d3d88212d9ca8aceee30d4089499a77bb05307871febd8073790f
Status: Image is up to date for linguist/grammar-compiler:latest
docker.io/linguist/grammar-compiler:latest
8 warnings found when compiling new grammar 'repository `vendor/grammars/d2-vscode` (from https://github.com/terrastruct/d2-vscode.git)':
- Unknown keys in grammar: `source.d2` (in `syntaxes/d2.tmLanguage.json`) contains invalid keys (`#`)
- Unknown keys in grammar: `text.html.markdown.d2` (in `syntaxes/markdown.tmLanguage.json`) contains invalid keys (`information_for_contributors`, `version`)
- Missing include in grammar: `text.html.markdown.d2` (in `syntaxes/markdown.tmLanguage.json`) attempts to include `source.json.comments` but the scope cannot be found
- Missing include in grammar: `text.html.markdown.d2` (in `syntaxes/markdown.tmLanguage.json`) attempts to include `text.log` but the scope cannot be found
- Missing include in grammar: `text.html.markdown.d2` (in `syntaxes/markdown.tmLanguage.json`) attempts to include `text.html.derivative` but the scope cannot be found
- Missing include in grammar: `text.html.markdown.d2` (in `syntaxes/markdown.tmLanguage.json`) attempts to include `text.git-rebase` but the scope cannot be found
- Missing include in grammar: `text.html.markdown.d2` (in `syntaxes/markdown.tmLanguage.json`) attempts to include `source.asp.vb.net` but the scope cannot be found
- Missing include in grammar: `text.html.markdown.d2` (in `syntaxes/markdown.tmLanguage.json`) attempts to include `text.git-commit` but the scope cannot be found

These warnings are not fatal, but may mean the syntax highlighting on GitHub.com may not be as expected.

OK! added grammar source 'vendor/grammars/d2-vscode'
	new scope: source.d2
	new scope: text.html.markdown.d2
Caching grammar license
/nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/vendor/fileutils/lib/fileutils.rb:105: warning: already initialized constant Bundler::FileUtils::VERSION
/nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/fileutils/lib/fileutils.rb:183: warning: previous definition of VERSION was here
/nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/vendor/fileutils/lib/fileutils.rb:1284: warning: already initialized constant Bundler::FileUtils::Entry_::S_IF_DOOR
/nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/fileutils/lib/fileutils.rb:2165: warning: previous definition of S_IF_DOOR was here
/nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/vendor/fileutils/lib/fileutils.rb:1568: warning: already initialized constant Bundler::FileUtils::Entry_::DIRECTORY_TERM
/nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/fileutils/lib/fileutils.rb:2461: warning: previous definition of DIRECTORY_TERM was here
/nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/vendor/fileutils/lib/fileutils.rb:1626: warning: already initialized constant Bundler::FileUtils::OPT_TABLE
/nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/fileutils/lib/fileutils.rb:2569: warning: previous definition of OPT_TABLE was here
/nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/vendor/fileutils/lib/fileutils.rb:1685: warning: already initialized constant Bundler::FileUtils::LOW_METHODS
/nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/fileutils/lib/fileutils.rb:2627: warning: previous definition of LOW_METHODS was here
/nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/vendor/fileutils/lib/fileutils.rb:1692: warning: already initialized constant Bundler::FileUtils::METHODS
/nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/fileutils/lib/fileutils.rb:2634: warning: previous definition of METHODS was here
bundler: failed to load command: licensed (/home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/bin/licensed)
Traceback (most recent call last):
	34: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/bin/bundle:18:in `<main>'
	33: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/bin/bundle:18:in `load'
	32: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/exe/bundle:33:in `<top (required)>'
	31: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
	30: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/exe/bundle:45:in `block in <top (required)>'
	29: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/cli.rb:28:in `start'
	28: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	27: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/cli.rb:34:in `dispatch'
	26: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	25: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	24: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	23: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/cli.rb:491:in `exec'
	22: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/cli/exec.rb:23:in `run'
	21: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/cli/exec.rb:58:in `kernel_load'
	20: from /nix/store/a84h36ysnaz6smy0p3zxmhh8r78ipjlf-bundler-2.4.6/lib/ruby/gems/2.7.0/gems/bundler-2.4.6/lib/bundler/cli/exec.rb:58:in `load'
	19: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/bin/licensed:25:in `<top (required)>'
	18: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/bin/licensed:25:in `load'
	17: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/exe/licensed:4:in `<top (required)>'
	16: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/exe/licensed:4:in `require'
	15: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed/cli.rb:2:in `<top (required)>'
	14: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed/cli.rb:2:in `require'
	13: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed.rb:7:in `<top (required)>'
	12: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed.rb:7:in `require'
	11: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed/sources.rb:2:in `<top (required)>'
	10: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed/sources.rb:3:in `<module:Licensed>'
	 9: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed/sources.rb:6:in `<module:Sources>'
	 8: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed/sources.rb:6:in `require'
	 7: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed/sources/bundler.rb:4:in `<top (required)>'
	 6: from /home/blaggacao/src/github.com/github-linguist/linguist/vendor/gems/ruby/2.7.0/gems/licensed-4.3.1/lib/licensed/sources/bundler.rb:4:in `require'
	 5: from /nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler.rb:7:in `<top (required)>'
	 4: from /nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler.rb:7:in `require_relative'
	 3: from /nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/errors.rb:3:in `<top (required)>'
	 2: from /nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/errors.rb:20:in `<module:Bundler>'
	 1: from /nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/errors.rb:20:in `<class:GemfileError>'
/nix/store/jk95ypnlgsc7ma0d2758zpbgk6r0m13b-ruby-2.7.7/lib/ruby/2.7.0/bundler/errors.rb:9:in `status_code': Trying to register Bundler::GemfileError for status code 4 but Bundler::GemfileError is already registered (ArgumentError)

@blaggacao
Copy link

When trying to prep the env, I get:

sudo apt-get install cmake pkg-config libicu-dev docker.io ruby ruby-dev zlib1g-dev build-essential libssl-dev --fix-missing
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
build-essential is already the newest version (12.9ubuntu2).
cmake is already the newest version (3.18.4-2ubuntu2).
libicu-dev is already the newest version (67.1-7ubuntu1).
libicu-dev set to manually installed.
pkg-config is already the newest version (0.29.2-1ubuntu1).
ruby is already the newest version (1:2.7+2build1).
libssl-dev is already the newest version (1.1.1l-1ubuntu1.6).
zlib1g-dev is already the newest version (1:1.2.11.dfsg-2ubuntu7.1).
docker.io is already the newest version (20.10.12-0ubuntu2~21.10.1).
The following additional packages will be installed:
  libgmp-dev libgmpxx4ldbl ruby2.7-dev ruby2.7-doc
Suggested packages:
  gmp-doc libgmp10-doc libmpfr-dev
The following NEW packages will be installed:
  libgmp-dev libgmpxx4ldbl ruby-dev ruby2.7-dev ruby2.7-doc
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 2,725 kB of archives.
After this operation, 26.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:1 http://us.archive.ubuntu.com/ubuntu impish/main amd64 libgmpxx4ldbl amd64 2:6.2.1+dfsg-1ubuntu2
  404  Not Found [IP: 91.189.91.38 80]
Err:2 http://us.archive.ubuntu.com/ubuntu impish/main amd64 libgmp-dev amd64 2:6.2.1+dfsg-1ubuntu2
  404  Not Found [IP: 91.189.91.38 80]
Ign:3 http://us.archive.ubuntu.com/ubuntu impish-security/main amd64 ruby2.7-dev amd64 2.7.4-1ubuntu3.2
Err:4 http://us.archive.ubuntu.com/ubuntu impish/main amd64 ruby-dev amd64 1:2.7+2build1
  404  Not Found [IP: 91.189.91.38 80]
Ign:5 http://us.archive.ubuntu.com/ubuntu impish-security/main amd64 ruby2.7-doc all 2.7.4-1ubuntu3.2
Err:3 http://us.archive.ubuntu.com/ubuntu impish-security/main amd64 ruby2.7-dev amd64 2.7.4-1ubuntu3.2
  404  Not Found [IP: 91.189.91.38 80]
Ign:5 http://us.archive.ubuntu.com/ubuntu impish-security/main amd64 ruby2.7-doc all 2.7.4-1ubuntu3.2
Ign:5 http://us.archive.ubuntu.com/ubuntu impish-security/main amd64 ruby2.7-doc all 2.7.4-1ubuntu3.2
Err:5 http://us.archive.ubuntu.com/ubuntu impish-security/main amd64 ruby2.7-doc all 2.7.4-1ubuntu3.2
  404  Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/g/gmp/libgmpxx4ldbl_6.2.1%2bdfsg-1ubuntu2_amd64.deb  404  Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/g/gmp/libgmp-dev_6.2.1%2bdfsg-1ubuntu2_amd64.deb  404  Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/r/ruby2.7/ruby2.7-dev_2.7.4-1ubuntu3.2_amd64.deb  404  Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/r/ruby-defaults/ruby-dev_2.7%2b2build1_amd64.deb  404  Not Found [IP: 91.189.91.38 80]
E: Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/r/ruby2.7/ruby2.7-doc_2.7.4-1ubuntu3.2_all.deb  404  Not Found [IP: 91.189.91.38 80]
E: Internal Error, ordering was unable to handle the media swap

→ I'm blocked and the allocated time budget is up.

@blaggacao
Copy link

blaggacao commented Apr 27, 2023

This is a language with 1.7k usage sites

D2Lang:
  type: data
  color: "#476cef" # main logo color
  aliases:
  - D2
  - d2
  extensions:
  - ".d2"

That's what I had added to ./lib/linguist/languages.yaml

@lildude
Copy link
Member

lildude commented Apr 28, 2023

@blaggacao your first problem (ignoring the grammar issues) appears to be because you've not yet setup your environment as per the docs and your second problem indicates a problem with reaching/finding the Ubuntu packages needed to setup your environment. This last problem isn't really a Linguist issue so this isn't the best place to discuss but try using different Ubuntu servers or an earlier version of Ubuntu.

@blaggacao
Copy link

blaggacao commented May 2, 2023

@lildude Indeed! My hope by exposing my pains wasn't to seek relief (I unfortunately can't sink more time into this), but for someone with a working environment to candidly take over.

For a short while, I had considered to add a nix development shell which would solve this problem for me and for others once and for all (on linux and mac), but I'm not familiar enough with ruby / bundler packaging, so - already being stretched thinky - I desisted.

@HariSekhon
Copy link

+1 for adding D2 language support

Right now GitHub isn't picking up the D2 language as existing at all in my cool new repo:

https://github.com/HariSekhon/Diagrams-as-Code

@goto1134 goto1134 mentioned this issue May 29, 2023
6 tasks
@goto1134
Copy link
Contributor

@lildude , I believe, we can close the issue now.

@lildude
Copy link
Member

lildude commented May 30, 2023

Yup.

@lildude lildude closed this as completed May 30, 2023
@github-linguist github-linguist locked as resolved and limited conversation to collaborators Jun 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Add Language Good First Issue This is a great opportunity to start contributing to Linguist
Projects
None yet
Development

No branches or pull requests

5 participants