tree-sitter-grammars / tree-sitter-markdown

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

Support ```js and ```ts as aliases for ```javascript and ```typescript #94

Closed CallumHoward closed 11 months ago

CallumHoward commented 1 year ago

Hopefully this might be the right level at which to solve this:

ghfmd seems to support js/ts as an abbreviation for javascript/typescript.


Example:

const a: string = "some highlighted ts code";
const a = "some highlighted js code";

In Neovim v0.9 with latest treesitter and parsers installed:

Screenshot 2023-04-10 at 4 18 44 pm Screenshot 2023-04-10 at 4 21 21 pm

Would it be possible to add aliases so that ts and js in the code block language specifier may work?

MDeiml commented 1 year ago

That's a problem with neovim. The parser just tells neovim that the language is "ts" and neovim needs to figure out what parser to use. Maybe this functionality is already implemented, but I didn't find anything about it immediately. You should probably ask in https://github.com/nvim-treesitter/nvim-treesitter

clason commented 1 year ago

Yes, that should be implemented, and works for me:

Screenshot 2023-05-13 at 20 25 35

Make sure your nvim-treesitter is fully updated.

(PR adding more common aliases to see https://github.com/nvim-treesitter/nvim-treesitter/blob/680807fa6a482c639119098bc48ca3831c66db13/lua/nvim-treesitter/query_predicates.lua#L10-L16 welcome).

MDeiml commented 11 months ago

Closing, as this is related to neovim and not this parser.