microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.65k stars 29.43k forks source link

Investigate existing tree-sitter grammars #207416

Closed alexr00 closed 8 months ago

alexr00 commented 8 months ago

Currently, we use textmate grammars for syntax highlighting. We get these grammars from other OSS projects, which let's us avoid becoming experts in every programming language that we support. Many of these OSS projects are no longer supported though, and we've had to take ownership of at least one of the grammars (css).

Tree-sitter appears to be popular right now for syntax highlight grammars, but before we consider adding support for tree-sitter grammars in VS Code, we should understand what grammars already have good tree-sitter support. In particular, the following textmate grammars have reached a dead-end and are particularly important to have support for in whatever syntax highlighting solution we support next:

Key: ✅ repo is very active ⚠️ limited repo activity ❌ no repo or no activity

All other textmate languages Summary: 10 will be more supported 5 will be less supported 5 will be equivalently unsupported | Language | Textmate maintained? | Tree-sitter maintained? | |----------|----------------------|--------------| | bat | ❌ | ❌ | | clojure | ❌ | ✅ https://github.com/sogaiu/tree-sitter-clojure | | coffeescript | ❌ | ❌ | | cpp | ❌ license changed | ✅ https://github.com/tree-sitter/tree-sitter-cpp | | csharp | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-c-sharp | | css | ⚠️ we maintain | ✅ https://github.com/tree-sitter/tree-sitter-css | | dart | ✅ | ✅ https://github.com/UserNobody14/tree-sitter-dart | | diff | ❌ | ✅ https://github.com/the-mikedavis/tree-sitter-diff | | docker | ❌ | ✅ https://github.com/camdencheek/tree-sitter-dockerfile | | fsharp | ✅ | ⚠️ https://github.com/Nsidorenco/tree-sitter-fsharp | | git | ✅ | ✅ https://github.com/gbprod/tree-sitter-gitcommit | | go | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-go | | handlebars | ⚠️ unclear if maintained | ❌ | | hlsl | ⚠️ unmaintained, 0 issues | ✅ https://github.com/tree-sitter-grammars/tree-sitter-hlsl | | java | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-java| | javascript | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-javascript | | json | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-json | | julia | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-julia | | latex | ✅ | ✅ https://github.com/latex-lsp/tree-sitter-latex | | less | ✅ | ❌ | | log | ✅ | ❌ | | lua | ✅ | ✅ https://github.com/tree-sitter-grammars/tree-sitter-lua | | make | ⚠️ | ⚠️ https://github.com/tree-sitter-grammars/tree-sitter-make | | markdown | ✅ | ✅ https://github.com/tree-sitter-grammars/tree-sitter-markdown | | objective c | ⚠️ | ⚠️ https://github.com/tree-sitter-grammars/tree-sitter-objc | | perl | ❌ | ❌ (license) https://github.com/tree-sitter-perl/tree-sitter-perl | | php | ⚠️ | ✅ https://github.com/tree-sitter/tree-sitter-php | | powershell | ❌ | ❌ | | pug | ❌ | ✅ https://github.com/zealot128/tree-sitter-pug | | **python** | ❌ | ✅ https://github.com/tree-sitter/tree-sitter-python | | razor | ✅ | ❌ | | ruby | ❌ | ✅ https://github.com/tree-sitter/tree-sitter-ruby | | rust | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-rust | | shellscript | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-bash | | sql | ✅ | ✅ https://github.com/derekstride/tree-sitter-sql | | swift | ✅ | ✅ https://github.com/alex-pinkus/tree-sitter-swift | | typscript | ✅ | ✅ https://github.com/tree-sitter/tree-sitter-typescript | | vb | ❌ | ❌ |
alexr00 commented 8 months ago

HTML ✅

Repo https://github.com/tree-sitter/tree-sitter-html
Activity commits in 2024
Stars 110
Used by Neovim and Zed
alexr00 commented 8 months ago

YAML ⚠️

Repo https://github.com/ikatyang/tree-sitter-yaml
Activity last commit was 3 years ago
Stars 81
Used by Neovim and emacs
Issues 18 open issues
Repo https://github.com/zed-industries/tree-sitter-yaml, fork of https://github.com/ikatyang/tree-sitter-yaml
Activity last commit was 9 mos ago
Stars 1
Used by Zed
Issues doesn't allow issues
Repo https://github.com/tree-sitter-grammars/tree-sitter-yaml , fork of https://github.com/ikatyang/tree-sitter-yaml
Activity only 1 commit since fork
Stars 0
Used by maybe no one
Issues allows issues but there are none
alexr00 commented 8 months ago

XML ✅

Repo https://github.com/tree-sitter-grammars/tree-sitter-xml
Activity very active in the last 12 months
Stars 14
Used by Neovim
Issues 5 closed issues
alexr00 commented 8 months ago

Groovy ✅

Repo https://github.com/murtaza64/tree-sitter-groovy
Activity very active in the last 12 months
Stars 7
Used by Neovim
Issues 1 open, 2 closed issues
alexr00 commented 8 months ago

Ini⚠️

Repo https://github.com/justinmk/tree-sitter-ini
Activity a little activity in the last 12 months
Stars 16
Used by Neovim
Issues 3 open, 1 closed issues
alexr00 commented 8 months ago

SCSS ❌

Repo https://github.com/serenadeai/tree-sitter-scss
Activity last commit was 2 years ago
Stars 22
Used by Neovim
Issues 7 open, 6 closed issues
NullVoxPopuli commented 8 months ago

handlebars could probably be handled by https://github.com/ember-tooling/tree-sitter-glimmer

KillyMXI commented 8 months ago

Curiously, 2 of those that would be "less supported" with tree-sitter are fsharp and razor...

alexr00 commented 8 months ago

I didn't find a razor grammar, but if I missed one then please let me know!

heartacker commented 8 months ago

@alexr00 涂鸦_Screenshot_2024-03-28-00-10-12-316_GitHub.png

is this done