styled-components / vim-styled-components

Vim bundle for http://styled-components.com based javascript files.
300 stars 24 forks source link

Improve indenting for filetype `typescript.tsx` #62

Closed fleischie closed 4 years ago

fleischie commented 5 years ago

The indenting in non-styled sections is not working, especially when in tsx sections:

Current behavior:

Screen Shot 2019-06-07 at 14 31 19

Somwhat desired behavior:

Screen Shot 2019-06-07 at 14 31 40

sheerun commented 5 years ago

The fix should look something like this to also account for vim-jsx-pretty plugin:

if &filetype =~ '^typescript' && exists('*GetTsxIndent')
  let s:JsIndentFunction = function('GetTsxIndent')
elseif &filetype =~ '^typescript' && exists('*GetTypescriptIndent')
  let s:JsIndentFunction = function('GetTypescriptIndent')
elseif exists('*GetJsxIndent')
  let s:JsIndentFunction = function('GetJsxIndent')
elseif exists('*GetJavascriptIndent')
  let s:JsIndentFunction = function('GetJavascriptIndent')
elseif exists('*GetJsIndent')
  let s:JsIndentFunction = function('GetJsIndent')
end
fleischie commented 5 years ago

Oh hey, thanks @sheerun for the hint. I might try it out whenever I feel like I can spare the moment. 🙇👍

kira-krul commented 4 years ago

I believe the issue is fixed and can be closed?

Jayphen commented 4 years ago

@sheerun Where should one put the above if/else block in order to fix this?