styled-components / vim-styled-components

Vim bundle for http://styled-components.com based javascript files.
300 stars 24 forks source link

Support for javascriptreact and typescriptreact filetypes #71

Closed Chris-Slade closed 4 years ago

Chris-Slade commented 4 years ago

Vim recently added javascriptreact and typescriptreact as filetypes, autodetected for .jsx and .tsx files (patch 8.1.1930). This plugin currently only supports the javascript and typescript filetypes.

See:

I'm not sure what the best way to support these filetypes would be while maintaining compatibility with versions that don't have this patch. Providing copies of all the after/*/{typescript,javascript}.vim files renamed to typescriptreact.vim/javascriptreact.vim would be an ugly, but working solution. Or maybe a branch with the files renamed, for users with the patch.

fleischie commented 4 years ago

Hello @Chris-Slade,

thanks for your research and reporting this issue, I was a bit busy the last few days, hence I will look in to this issue only now.

(I thought there was something off with indenting on typescript + react, but I had prettier take care of formatting so 🤷‍♂ .)

fleischie commented 4 years ago

@Chris-Slade

Could you check out the newest develop branch to see if that fixes your problem (if you had a specific one). I did something, but I couldn't really focus on this task at the moment.

Let me know, if it helps or if you think this should be enough. 😅

Chris-Slade commented 4 years ago

@fleischie Thanks for the response. runtime! seems to be the right way to handle this. Since https://github.com/styled-components/vim-styled-components/commit/22d5d88b43126b1014c7c484854fc7af38d1920e only added aliases for the indent scripts, I created PR https://github.com/styled-components/vim-styled-components/pull/72 to source the syntax and ftplugin scripts as well. Tested on JS and TS React projects and everything seems to be working with those changes (omnifunc, highlighting, indenting).

fleischie commented 4 years ago

Cool. :+1: I just merged it an will make a new release.

For future reference: If this will be an issue again, please open another issue. :v: