Filetype *.tsx doesn't belong in this plugin
kballenegger opened this issue · 6 comments
I load my plugins with Pathogen, meaning they're loaded in alphabetical order. This plugin detects TSX like so:
autocmd BufNewFile,BufRead *.ts,*.tsx setlocal filetype=typescript
ianks/vim-tsx
detects TSX like so:
autocmd BufNewFile,BufRead *.tsx set filetype=typescript.tsx
Since this plugin's autocmd
detection can be run after the tsx
plugin is loaded, it effectively sets the wrong filetype to typescript
instead of typescript.tsx
.
In my opinion, this plugin shouldn't try to work on TSX files. Let the TSX plugin do that. But if y'all don't agree, at least try to detect whether the TSX plugin is loaded and only handle *.tsx
files if it is not.
Sounds good to me.
Should I make a PR removing the *.tsx
detection?
yes please!
I might also have a look to see if we can only set it when not already done.
#111 Here you go.
I looked briefly into detection, but I'm not good enough at vimscript to figure it out.
I made a suggestion to your #111 PR. We should be good with that.
Note, there are still other plugins that might break this e.g. Quaramy/tsuquyomi also detects *.tsx files - so that will need to be fixed or ensure that it is before ianks/vim-tsx in your config.
Luckily for me, tsx
comes after tsu
in the alphabet, so Tsuquymi hasn't been an issue. But yeah, same concept.