ianks / vim-tsx

85 stars 8 forks source link

Does this work #1

Open ericwooley opened 8 years ago

ericwooley commented 8 years ago

I tried installing it, can't seem to get it to work right. I am also using syntastic if that matters.

ianks commented 8 years ago

yes it does, what does your filetype in vim read when you open a tsx file?

ianks commented 8 years ago

:set ft

indiesquidge commented 8 years ago

Hmm, yeah I can't get this to work either. The dependency is on leafgarland/typescript-vim, correct? It's really just a copy of mxw/vim-jsx (with different syntax selectors), which works fine for me, including correct indentation and commenting

screen shot 2016-06-11 at 8 30 57 pm
ianks commented 8 years ago

the dependency is on typescript-vim. @indiesquidge does anything change when you switch the plugin ordering?

indiesquidge commented 8 years ago

@ianks, good question, I hadn't considered that. Unfortunately, after trying both orders, nothing changed and the plugin still won't work 😕

ianks commented 8 years ago

Are all your plugins up to date?

indiesquidge commented 8 years ago

Yeah

indiesquidge commented 8 years ago

This all works for you seamlessly? Commenting, indentation, highlighting? Everything just how it does in a .jsx file with mxw/vim-jsx?

ianks commented 8 years ago

Yes it does.

ianks commented 8 years ago

are you in a *.tsx file? can you paste the output of :set ft in from a tsx buffer?

ianks commented 8 years ago

I looked in your dotfiles, this line is causing it not to work:

autocmd BufRead,BufNewFile *.tsx setlocal filetype=typescript

ianks commented 8 years ago

setting the FT is done by this plugin, and it should be typescript.tsx

indiesquidge commented 8 years ago

Ah, that's an old line that's been removed locally for a bit now. Doesn't seem to be the cause of the issue still though.

indiesquidge commented 8 years ago

Strangely, even without that line, my filetype is still set to typescript. If I manually set it it to typescript.tsx, some problems are solved! Syntax highlighting will show up correctly and indentation works as expected. However, commenting lines out still acts like it's a TypeScript comment (// ...) rather than a TSX comment ({/* ... */})

ianks commented 8 years ago

Does that work on vim-jsx?

indiesquidge commented 8 years ago

The commenting feature? Yeah, it works. I'm wondering what's keeping my filetype from being set correctly now. I have nothing left in my dotfiles that explicitly sets any filetypes, so I would think the plugin's setter would work 😖

ianks commented 8 years ago

do you use https://github.com/Quramy/tsuquyomi ?

indiesquidge commented 8 years ago

Ha, yeah, that's the issue. Looks like ianks/vim-tsx must come after Quramy/tsuquyomi. I'm feeling like I should bring it to Quramy's attention that his plugin is causing conflicts with something that is meant to work with .tsx files.

ianks commented 8 years ago

yeah, a pr to them setting the ft to typescript.tsx should be backwards compatible, if someone were to make that pr :wink:

indiesquidge commented 8 years ago

Looks like leafgarland/typescript-vim sets this as well. Two PRs!

indiesquidge commented 8 years ago

Note that this is even an issue between mxw/vim-jsx and pangloss/vim-javascript.

renebrandel commented 8 years ago

image I have put this plugin after all the other named plugins. Everything works great but the brackets. Can you recreate this?

renebrandel commented 8 years ago

It also doesn't check for quote escapes within the code. image

ianks commented 8 years ago

@brene I think it actually has to do with arrow functions:

arrow-funcs-bug

I do not have to time right now to try to debug this, however.

lpender commented 6 years ago

It definitely does not indent properly:

Before adding:

image

After adding:

image