tree-sitter-grammars / tree-sitter-markdown

Markdown grammar for tree-sitter
MIT License
411 stars 52 forks source link

fix: remove unnecessary conflicts #110

Open amaanq opened 1 year ago

amaanq commented 1 year ago

image

amaanq commented 1 year ago

Ah...this grammar has conditional compilation - I forgot :see_no_evil:

Though I can't reproduce it locally using the npm scripts

MDeiml commented 1 year ago

Yes, thanks for the effort though. Btw if you have any suggestion on how to do the conditional compilation better I'm all ears. But as it is tree-sitter doesn't seem to have good support for this.

amaanq commented 1 year ago

Yes, thanks for the effort though. Btw if you have any suggestion on how to do the conditional compilation better I'm all ears. But as it is tree-sitter doesn't seem to have good support for this.

Your way is fine - though it is not the "prettiest", I wonder if we could add a features-flag to grammars like how Rust crates do it tree-sitter generate --features x and it'll check if x exists in the package.json['tree-sitter'][lang_idx][features] array

MDeiml commented 11 months ago

FYI There's some discussion about this on multiple fronts like https://github.com/tree-sitter/tree-sitter-cpp/issues/40 and https://github.com/nvim-treesitter/nvim-treesitter/issues/3076 which came to similar results.

(Keeping this open since probably the conflicts should also be part of the conditonal compilation)