vim-context-commentstring icon indicating copy to clipboard operation
vim-context-commentstring copied to clipboard

Improve Typescript React support

Open Arelav opened this issue 3 years ago • 4 comments

I use vim-coc and looks like it sets filetype typescriptreact for tsx files. Anyways I'm keeping previous functionality just in case somebody used it. For my current setup the implementation is much simple.

let g:context#commentstring#table['typescriptreact'] = {
      \ 'tsxRegion': '{/*%s*/}'
      \}

Arelav avatar Apr 28 '21 06:04 Arelav

👋

Arelav avatar Jun 10 '21 00:06 Arelav

Hi.

Thank you for the patch, and sorry for not replying before. I don't use vim so heavily nowadays, and certainly I don't do HTML stuff, pretty much at all. I wasn't already confident with the patch I accepted before, and even less with this one (because I don't know how to test it, and I'm quite confused with the technologies).

Do you mind if I ask you a few questions? It's fine if you don't know them all.

  1. You added support for a new file type, but did the others need change, or you did so as a cleanup?
  2. Is there any difference between typescript.tsx and typescript.jsx?
  3. What's different between typescriptreact and the others? Why you only need one syntax region?

Thank you.

suy avatar Jun 11 '21 07:06 suy

While this can't be merged now due to the conflicts (I've pushed some changes), let me know which syntax highlighting are using, and I'll look into fixing this myself if you don't find the time.

I'm struggling to find out which syntaxes might be the most popular ones to ship defaults here. Although I'm also considering that I should leave this to users to extend themselves in their config (it's just a line of code to extend the variable), because if there are too many different options, it's just not going to work well. Each user will need to adjust to their syntax.

suy avatar Jun 15 '21 12:06 suy

Sorry. I have seen your message but had no time to immediately respond. The different file types for Javascript/Typescript react files come from different plugins users can install for Typescript support.

Like:

sheerun/vim-polyglot leafgarland/typescript-vim dense-analysis/ale neoclide/coc.nvim I used different combinations so you can track changes in my previous PR. It would be nice to have some simple solution however many people can use different setups.

Arelav avatar Jun 15 '21 14:06 Arelav