jparise / vim-graphql

A Vim plugin that provides GraphQL file detection, syntax highlighting, and indentation.
MIT License
487 stars 25 forks source link

Breaks indentation if used with vim-jsx-pretty #62

Closed sheerun closed 3 years ago

sheerun commented 4 years ago

This plugin breaks (disables) indentation for jsx code if vim-jsx-pretty is used. To reproduce please use following ~/.vimrc.test:

call plug#begin()

set sw=2 ts=2

Plug 'pangloss/vim-javascript'
Plug 'MaxMEllon/vim-jsx-pretty'
Plug 'jparise/vim-graphql'

call plug#end()

And then open .js file with jsx with vim -N -u ~/.vimrc.test component.js

sheerun commented 4 years ago

Please see how vim-styled-components solved this: https://github.com/styled-components/vim-styled-components/blob/main/after/indent/javascript.vim#L138-L166

jparise commented 4 years ago

Thanks for the pointer! It looks like supporting the full "stack" of JS-adjacent plugins will be pretty involved so it will take me some time to put together a good test suite. Please add any important examples and test cases to this issue so I can include them.

I'll try to pick this up over the weekend.

sheerun commented 4 years ago

let l:result = cindent(v:lnum) + recursion safeguard should be enough, no need to support stack of them