vim-matchup
vim-matchup copied to clipboard
Support for typescript.tsx format
I maintain my own syntax file for typescript, that uses typescript.tsx as the filetype. I've noticed that JSX tag matching does not work with matchup. Is there an easy way to add support for this so it works like typescriptreact?
Are you using tree-sitter or no?
If yes, I think easiest way would be to copy the query files. I am not sure how nvim-treesitter works with dotted types so you better check with them.
If no, you can copy the ftplugin files.
If I have some details I can give more specific instructions.
I’m old school, I don’t use neovim, but thanks for the pointers on ftplugins, I’ll poke around on it! Thanks!
I think you should be able to get pretty far with creating a file like this
{personal config}/after/ftplugin/tsx.vim:
let b:match_words = matchup#util#standard_html()
I use tsx.vim since vim should load both typescript and tsx ftplugins.
Ahh yup, that seems to fix! Is there any possibility to get that filetype supported out of the box though? I know some other plugins support typescript.tsx, but I understand if you think it's too niche or out of scope for this plugin
I am wary to support two differently named filetypes that are actually referring to the same thing.
Is there a key reason you are using typescript.tsx instead of the built in name typescriptreact? Is it just because you want to completely have your own handling?
The decision was mostly because it felt like the morecorrect naming convention:
- The JavaScript syntax support uses the convention javascript.jsx
- The typescript equivalent would be .tsx
- The fact that the default syntax files use the library name react when the files could be rendering vue or other frameworks that take advantage of jsx also felt off to me
So yeah, mostly ideological reasons, so I understand if you prefer not to support it. Maybe one day this is something that can get corrected in the vim codebase