Closed jparise closed 3 years ago
@sheerun I think this should address the issue you reported in #62.
I don't think I need a recursion guard here like the one used by vim-styled-components, but I may have missed a complex case that would require it.
I guess you don't need it it with this implementation, but I suspect syntack is very slow... And this function will be called for each line in file
Actually never mind, styled components does the same
btw. maybe you could use synstack(a:lnum, a:cnum)
instead of synstack(a:lnum, 1)
?
btw. maybe you could use
synstack(a:lnum, a:cnum)
instead ofsynstack(a:lnum, 1)
?
Do you have an example where that would make a difference? The GraphQL indentation implementation is essentially line-based, but if using the column number would make it more correct, I'd be fine changing it.
I guess you don't need it it with this implementation, but I suspect syntack is very slow... And this function will be called for each line in file
When I originally wrote that code, I looked for alternatives, but this approach seemed the only way to get build an accurate check. I'd love to use something faster, though.
no idea, it just feels more correct
Stop assuming the name of the base JavaScript or TypeScript indentation function and instead store and use the buffer's existing &indentexpr for non-GraphQL lines.
This should produce more correct results when other plugins are also wrapping &indentexpr (such as vim-jsx-pretty and vim-styled-components).
Fixes #62