Skip to content

gqq on multiline comment results in infinite loop #218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pyrho opened this issue Nov 10, 2020 · 2 comments
Open

gqq on multiline comment results in infinite loop #218

pyrho opened this issue Nov 10, 2020 · 2 comments

Comments

@pyrho
Copy link

pyrho commented Nov 10, 2020

Hey 👋 ,

Sample test.ts:

 /*
 * arstarstarstarstarstarstarstarstarstarstarstarsienoeinoeinoneoarstarstarstarstarstarstarstarstarstarstarstarsienoeinoeinoneoarstarstarstarstarstarstarstarstarstarstarstarsienoeinoeinoneoarstarstarstarstarstarstarstarstarstarstarstarsienoeinoeinoneo
 */

Issuing gqq on the middle (long) line run an infinite loop (CPU core maxed out, "gqq" flashing in the cmd line).

Somewhat related to #209 I guess.

I suspect this is a bug in the Fixedgq function.

Side note: It seems that the Fixedgq function actively dismisses formatting multiline comments. But that's precisely why I use gqq for; my code formatting needs are handled by prettier. I would prefer it for my syntax files to not mess with that.

Thanks!

fsouza added a commit to fsouza/dotfiles that referenced this issue Nov 12, 2020
Workaround for HerringtonDarkholme/yats.vim#218.

Also change code to make sure we only trigger filetype once (assuming
vim.schedule is FIFO?)
@randallagordon
Copy link

I'm also seeing this, after taking a peek at #216 I'm curious if #212 may have introduced this as well?

If anyone else is using this via vim-polyglot using 05e21a9e252b283b2d71568ad3b671d7f28fe0bc gets things rollin' again!

@jonmast
Copy link

jonmast commented Apr 7, 2022

At least for me this is caused by using the neovim-treesitter highlighting. When this is active you can no longer query the current syntax group using synId, which yats#IsInMultilineComment depends on to work.

There is some discussion around this in nvim-treesitter/nvim-treesitter#1228, it seems we'd need do something custom for treesitter to make this work. In the meantime adding an option to disable the custom formatter as suggested in #247 could be a good workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants