Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for typescript.tsx format #224

Open
amadeus opened this issue May 23, 2022 · 6 comments
Open

Support for typescript.tsx format #224

amadeus opened this issue May 23, 2022 · 6 comments

Comments

@amadeus
Copy link

amadeus commented May 23, 2022

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?

@andymass
Copy link
Owner

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.

@amadeus
Copy link
Author

amadeus commented May 24, 2022

I’m old school, I don’t use neovim, but thanks for the pointers on ftplugins, I’ll poke around on it! Thanks!

@andymass
Copy link
Owner

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.

@amadeus
Copy link
Author

amadeus commented May 26, 2022

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

@andymass
Copy link
Owner

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?

@amadeus
Copy link
Author

amadeus commented May 27, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants