Closed fcanela closed 3 years ago
I thought this might be caused by a conflict with yats.vim which is what vim-polyglot uses for TypeScript syntax highlighting and indentation, but when you load just yats.vim and vim-styled-components, indentation works fine. It seems that the conflict is with code specific to vim-polyglot.
I'm experiencing this too.
I notice when I run :verbose set indentexpr?
with this plugin disabled, I can see Last set from <snip>/vim-polyglot/indent/typescript.vim line 19
If I enable this plugin and run the command again, I see Last set from <snip>/vim-polyglot/after/indent/javascript.vim
.
I have no idea what this means, but perhaps it helps debugging.
edit: https://github.com/styled-components/vim-styled-components/blob/main/after/indent/typescript.vim erm, is it this?
If I comment out the above, the indenting works.
Personally I've removed the indent/typescript.vim
file from the plugin locally, because I only use css-in-js in typescriptreact files anyway. Keen to know if there's a proper solution
If I load vim-styled-components
after vim-jsx-pretty, then indentation works in more places, like function bodies. But still doesn't work in json. Had to stop using vim-styled-components.
@stevematney BTW this happens without using vim-polyglot, I'm just using plugged here.
Just remove https://github.com/styled-components/vim-styled-components/blob/main/after/indent/typescriptreact.vim#L1 from all the files in the indent folder.
The same issue is here. Is there any update ?
The same issue is here too :/
When I open another file with other types, when come back to typescript file, indentation works perfectly, even using vim-styled-components
I merged a PR that advertised to fix this issue. I did not test it, but it is available on the develop branch. If you want you can check it out.
In my tests, it's working perfectly!!! Thanks for the fix :)
Is there any chance that the fix can be merged from the develop
branch into the main
branch? I also tested the develop
branch, and it fixed the issue for me as well.
I also noticed that the only other change present in develop
that's not in main
is the message in the README about this project needing a maintainer. Since GitHub only shows the default branch's README by default, that message is not currently being displayed on the main page of the project. You might get more volunteers if you just merged develop
into main
so that message is more visible. (I sadly don't think I can volunteer because I don't really know vimscript, but I appreciate the work you've done!)
Cut a new release with the proposed changes, @richardxia thanks for letting me know...
Thank you!
In the first place, thanks for creating & maintaining the plugin. I have recently found an issue with indenting and tracked it down to a conflict of plugins.
What happens: When both plugins are enabled, the indentation level is not preserved when pressing enter to create a new line.
Example:
Expected:
The auto-indentation after curly braces is also disabled.
Expected:
All the expected behaviors occur when I disable
vim-styled-components
and stop when I reenable it. The behavior affected.ts
files but not.js
.Minimal init.vim to replicate:
I am using NVIM v0.3.8 under Ubuntu 18.04.
I think this could be related to issue #74. I have also tried to apply the code of #62 to my init.vim without success.