Plugin hangs and maxes CPU upon inserting a newline in a JS file
b0o opened this issue ยท 10 comments
After upgrading to 493190e, this plugin is causing (neo)vim to hang.
Any time I try to insert a line break, e.g. by pressing o
in normal mode or <return>
in insert mode, vim immediately hangs and starts maxing out the CPU. I have to manually kill the vim process.
I have tried to edit several different JS files with the same results, from a very simple file which consists of only the following line...
let foo = "bar"
...to more complex files which contain JSX and styled-components tags, all with the same results.
Downgrading to 1344c3d resolves the problem.
Environment details:
neovim:
NVIM v0.2.2
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -Wconversion -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.2.2/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser
Features: +acl +iconv +jemalloc +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
system (arch linux):
Linux 4.16.8-1-ARCH x86_64 GNU/Linux
plugin manager: dein.vim
I can provide additional details if necessary.
Oh, wow. What a thorough issue report. Thank you for your effort. ๐
Unfortunately I am aware of this but wasn't able to fix it, yet. This particular behavior is due to a infinite recursion between vim-styled-component
's and vim-jsx
's indenting function, that call each other.
The official, recommended quick-fix is to downgrade to the commit you mentioned.
I am working on it though. โ๏ธ
@fleischie Glad to hear! I really appreciate your work on this plugin, it's made my life a lot easier!
Did you have the time to check the other commit/newer HEAD? I put more effort into it, after seeing the suggested commit didn't fix it, but broke the indenting on all of the jsx files? ๐
Now I'm relatively positive, that the current develop
branch is in a usable state.
No pressure, but if it works for you as well, I might just make another release of this. ๐
@fleischie Sorry for the delayed response - 2880d81 works!
By the way, since you seem to have develop
as the default branch, I think most plugin managers will install/update to the latest HEAD from there rather than the most recent release. Maybe you should make master
default so that unstable code isn't automatically installed when people update their vim plugins?
@b0o As you may have noticed. I took your advice and made main
the default branch, now. I appreciate it, that you (unlike me) paid attention. ๐
๐
@fleischie this breaks updates and installation using VimPlug. I solved this using:
Plug 'styled-components/vim-styled-components', { 'branch': 'main', 'for': 'javascript.jsx' }
You may want to update the README to the above or change the branch name to master
instead of main
(master is more standard and more likely to work out of the box for most plugin managers).