mxw / vim-jsx

React JSX syntax highlighting and indenting for vim.
1.59k stars 95 forks source link

Doesn't handle lambda functions #66

Closed toroman closed 8 years ago

toroman commented 9 years ago

The > in () => expr breaks the syntax highlighting. For example:

<div onClick={() => console.log('foo')} className="will not be highlighted" />
mxw commented 9 years ago

Huhn... I've never seen this lambda syntax. Is it an ES6 thing?

adamaig-verve commented 9 years ago

This is a little bit of a separate comment, but while the fat-arrow syntax has been added to es6 (see babel's docs), but it in't a good idea to use bind(this) or arrow functions in the props the way this request is asking to do things. See the description of the eslint-plugin-react rule "jsx-no-bind: Prevent usage of .bind() and arrow functions in JSX props" for details (https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-no-bind.md).

mxw commented 9 years ago

@toroman—Can you screenshot the example? Is the problem that the => is closing the tag, perhaps?

mxw commented 8 years ago

I actually can't repro this anymore (I don't remember if I tried before...). Is it still an issue for you, @toroman?

toroman commented 8 years ago

No I don't think so. I actually disabled the extension because it messes up the indentation. Like, new lines always start at column 0. Very annoying. Not sure what's causing it.

On Mon, Feb 1, 2016 at 9:37 AM, Max Wang notifications@github.com wrote:

I actually can't repro this anymore (I don't remember if I tried before...). Is it still an issue for you, @toroman https://github.com/toroman?

— Reply to this email directly or view it on GitHub https://github.com/mxw/vim-jsx/issues/66#issuecomment-178088758.

~toroman

mxw commented 8 years ago

@toroman—User error? Works fine for me; you most likely haven't installed vim-javascript, or have another plugin that's introducing a disruptive conflict.

toroman commented 8 years ago

I have vim-javascript, not sure if something else is messing it up.

On Mon, Feb 1, 2016 at 11:12 AM, Max Wang notifications@github.com wrote:

@toroman https://github.com/toroman—User error? Works fine for me; you most likely haven't installed vim-javascript, or have another plugin that's introducing a disruptive conflict.

— Reply to this email directly or view it on GitHub https://github.com/mxw/vim-jsx/issues/66#issuecomment-178134723.

~toroman

toroman commented 8 years ago

Fact is, disabling vim-jsx solves the problem.

On Mon, Feb 1, 2016 at 11:38 AM, Srecko Toroman sreckotoroman@gmail.com wrote:

I have vim-javascript, not sure if something else is messing it up.

On Mon, Feb 1, 2016 at 11:12 AM, Max Wang notifications@github.com wrote:

@toroman https://github.com/toroman—User error? Works fine for me; you most likely haven't installed vim-javascript, or have another plugin that's introducing a disruptive conflict.

— Reply to this email directly or view it on GitHub https://github.com/mxw/vim-jsx/issues/66#issuecomment-178134723.

~toroman

~toroman

toroman commented 8 years ago

So let me know if you want to stop by my desk and investigate :)

On Mon, Feb 1, 2016 at 11:38 AM, Srecko Toroman sreckotoroman@gmail.com wrote:

Fact is, disabling vim-jsx solves the problem.

On Mon, Feb 1, 2016 at 11:38 AM, Srecko Toroman sreckotoroman@gmail.com wrote:

I have vim-javascript, not sure if something else is messing it up.

On Mon, Feb 1, 2016 at 11:12 AM, Max Wang notifications@github.com wrote:

@toroman https://github.com/toroman—User error? Works fine for me; you most likely haven't installed vim-javascript, or have another plugin that's introducing a disruptive conflict.

— Reply to this email directly or view it on GitHub https://github.com/mxw/vim-jsx/issues/66#issuecomment-178134723.

~toroman

~toroman

~toroman

mxw commented 8 years ago

I'd expect that disabling vim-jsx also makes inline XML highlighting break...

Anyway, I've tested some more lambda-syntax cases, and they all seem to work. This is probably due to an outdated vim-javascript package, or some other package that interferes. (There are some auxiliary JS packages that don't do filetype detection correctly for compound filetypes, e.g.) In any case, it's not a vim-jsx issue.

(And I would—but I work out of Boston now :D)

toroman commented 8 years ago

Ah, kk. Will update my plugins and check for conflicts.

Best, Srecko

On Mon, Feb 1, 2016 at 11:51 AM, Max Wang notifications@github.com wrote:

I'd expect that disabling vim-jsx also makes inline XML highlighting break...

Anyway, I've tested some more lambda-syntax cases, and they all seem to work. This is probably due to an outdated vim-javascript package, or some other package that interferes. (There are some auxiliary JS packages that don't do filetype detection correctly for compound filetypes, e.g.) In any case, it's not a vim-jsx issue.

(And I would—but I work out of Boston now :D)

— Reply to this email directly or view it on GitHub https://github.com/mxw/vim-jsx/issues/66#issuecomment-178153317.

~toroman