Open devstefancho opened 1 year ago
The tsx
parser is weird; it's actually one parser handling two grammars (typescript and tsx), so I'm not surprised that something is not working.
@steelsojka
I don't really think it's steelsojka's problems or anything, probably just the mimetype detection for markdown not working?
If the language of the parser is tsx
, it should work out of the box. And steelsojka is listed as the maintainer for tsx
, so anything related to that language is his problem by definition.
@lucario387 Could you let me know what is the mimetype detection? I want to try anything I can do.
@lucario387 Could you let me know what is the mimetype detection? I want to try anything I can do.
Hello, the part in question is this https://github.com/nvim-treesitter/nvim-treesitter/blob/95850f7964e5be713ab984384641cc15973626c6/lua/nvim-treesitter/query_predicates.lua#L18-L41
The codeblock above is the part responsible for detecting info string codeblocks, such as ts -> typescript, js -> javascript, ...
So changing the logic there will change the logic everywhere
@clason @lucario387 Thanks for your support, now syntax highlighting works well, though tsx is not working yet. it's okay because typescriptreact syntax highlighting is working instead
and now markdown headers also are colorized it looks good for me(is this related with #5006 ?)
I now use treesitter commit 7b04e8b67eec7d92daadf9f0717dd272ddfc81a3
{
"ChatGPT.nvim": { "branch": "main", "commit": "be2c62986ef3223a61d2f1dcf41915a70307afca" },
"Comment.nvim": { "branch": "master", "commit": "e1fe53117aab24c378d5e6deaad786789c360123" },
"LuaSnip": { "branch": "master", "commit": "500981ff6cefc7343e3959ef0f939bd0bfd49ba9" },
"bufferline.nvim": { "branch": "main", "commit": "243893ba9d5d1049dd451a25cab32ec7f8f67bcf" },
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "0e6b2ed705ddcff9738ec4ea838141654f12eeef" },
"codi.vim": { "branch": "master", "commit": "83b9859aaf8066d95892e01eb9c01571a4b325dd" },
"copilot.vim": { "branch": "release", "commit": "1358e8e45ecedc53daf971924a0541ddf6224faf" },
"emmet-vim": { "branch": "master", "commit": "def5d57a1ae5afb1b96ebe83c4652d1c03640f4d" },
"gitsigns.nvim": { "branch": "main", "commit": "e5edefd9976039f5352e0c900f35206770b33a2d" },
"harpoon": { "branch": "master", "commit": "8cb54c4003045fe1b690de96638d334de9449546" },
"indent-blankline.nvim": { "branch": "master", "commit": "018bd04d80c9a73d399c1061fa0c3b14a7614399" },
"lazy.nvim": { "branch": "main", "commit": "ceb413678dfcf3d5455208959185e3db1f7892c7" },
"lspsaga.nvim": { "branch": "main", "commit": "f65d03cad9f3ab6c2c83ac0fbe2cda50731eb79b" },
"lualine.nvim": { "branch": "master", "commit": "84ffb80e452d95e2c46fa29a98ea11a240f7843e" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "cec0e6dd534ade486b5eeb59ebcfa8d51c3e8c5e" },
"mason-null-ls.nvim": { "branch": "main", "commit": "54d702020bf94e4eefd357f0b738317af30217eb" },
"mason.nvim": { "branch": "main", "commit": "057ac5ca159c83e302a55bd839a96ff1ea2396db" },
"neodev.nvim": { "branch": "main", "commit": "ab4c68129b5fefe5c6bb6d7e92283d3f8bdf8566" },
"nui.nvim": { "branch": "main", "commit": "698e75814cd7c56b0dd8af4936bcef2d13807f3c" },
"null-ls.nvim": { "branch": "main", "commit": "33b853a3933eed3137cd055aac4e539e69832ad0" },
"nvim-autopairs": { "branch": "master", "commit": "7747bbae60074acf0b9e3a4c13950be7a2dff444" },
"nvim-cmp": { "branch": "main", "commit": "0f47dcaf7e39d64cd067e090e6f2eda6326e7366" },
"nvim-colorizer.lua": { "branch": "master", "commit": "36c610a9717cc9ec426a07c8e6bf3b3abcb139d6" },
"nvim-dap": { "branch": "master", "commit": "56118cee6af15cb9ddba9d080880949d8eeb0c9f" },
"nvim-dap-ui": { "branch": "master", "commit": "749bfe12d1447703899fa823c1c075fbe2d42c24" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "ab988dbb7d20cdaebf9b3ef7554a89f6895de042" },
"nvim-dap-vscode-js": { "branch": "main", "commit": "03bd29672d7fab5e515fc8469b7d07cc5994bbf6" },
"nvim-lspconfig": { "branch": "master", "commit": "3bd4ca412982afa6f88bb7ef890660cee51c3e58" },
"nvim-tree.lua": { "branch": "master", "commit": "59e65d88db177ad1e6a8cffaafd4738420ad20b6" },
"nvim-treesitter": { "branch": "master", "commit": "7b04e8b67eec7d92daadf9f0717dd272ddfc81a3" },
"nvim-ts-autotag": { "branch": "main", "commit": "40615e96075c743ef47aaf9de966dc348bec6459" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "0bf8fbc2ca8f8cdb6efbd0a9e32740d7a991e4c3" },
"nvim-ufo": { "branch": "main", "commit": "45aede6f5c4981156df3ddeeae01c4290e43e104" },
"nvim-web-devicons": { "branch": "master", "commit": "b34362b20a4942b3245f958e73ebe1b09b020ad1" },
"obsidian.nvim": { "branch": "main", "commit": "0418505ff7d1e06460450a02b9209d03f4c2a50d" },
"playground": { "branch": "master", "commit": "2b81a018a49f8e476341dfcb228b7b808baba68b" },
"plenary.nvim": { "branch": "master", "commit": "9ac3e9541bbabd9d73663d757e4fe48a675bb054" },
"promise-async": { "branch": "main", "commit": "e94f35161b8c5d4a4ca3b6ff93dd073eb9214c0e" },
"rose-pine": { "branch": "main", "commit": "2eace84d649d76d41dcd44a87a17f64c7c4a586d" },
"sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" },
"telescope-dap.nvim": { "branch": "master", "commit": "313d2ea12ae59a1ca51b62bf01fc941a983d9c9c" },
"telescope-file-browser.nvim": { "branch": "master", "commit": "e0fcb12702ad0d2873544a31730f9aaef04fd032" },
"telescope-frecency.nvim": { "branch": "master", "commit": "0a4a521471141ae3c94ff0ebcffcaff3c3aad147" },
"telescope-project.nvim": { "branch": "master", "commit": "7c64b181dd4e72deddcf6f319e3bf1e95b2a2f30" },
"telescope.nvim": { "branch": "master", "commit": "c1a2af0af69e80e14e6b226d3957a064cd080805" },
"toggleterm.nvim": { "branch": "main", "commit": "026dff5e2b504941cf172691561a67ea362596aa" },
"tokyonight.nvim": { "branch": "main", "commit": "f2ed28707a0ad49047d9b733395ea205ea09f517" },
"true-zen.nvim": { "branch": "main", "commit": "98740c76254c65576ec294551028b65081053588" },
"typescript.nvim": { "branch": "main", "commit": "f66d4472606cb24615dfb7dbc6557e779d177624" },
"vifm.vim": { "branch": "master", "commit": "07fec88cc592d131e028cb70242c8b216ecde149" },
"vim-illuminate": { "branch": "master", "commit": "a2907275a6899c570d16e95b9db5fd921c167502" },
"vim-jsdoc": { "branch": "master", "commit": "9234b2e2590e973c06113c05abd180de0c9dbcc1" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vimwiki": { "branch": "dev", "commit": "09804c2a5f1009fde29e32c5f3a6093e4684433a" },
"vscode-js-debug": { "branch": "main", "commit": "2b2100d5aebaee7d45a6da7e8b8f3db7564e5981" }
}
Sorry for confusion I found that previous screenshot was vimwiki filetype and markdown filetype still not work, so I reopen this issue
I have the same issue. Is there a way to add aliases to fenced languages in markdown?
Yes, vim.treesitter.language.register()
(on Nvim 0.10).
Yes,
vim.treesitter.language.register()
(on Nvim 0.10).
I think it is do no work for fenced languages in markdown.
I tried all possible variants:
vim.treesitter.language.register('js', 'tsx')
and
vim.treesitter.language.register('javascript', 'tsx')
and all possible variants of 'javascript' and 'typescript', but I'm not getting the highlight for the tsx blocks.
Describe the highlighting problem
:TSInstall tsx
. I've confirmed it's installed by checking with:TSInstallInfo
, which shows that tsx is indeed installed.Example snippet that causes the problem
Click Event without passing parameter
Tree-sitter parsing result
Example screenshot
Expected behavior
Syntax highlight with tsx code
Output of
:checkhealth nvim-treesitter
For more information of the config from my init.lua