shellRaining / hlchunk.nvim

This is the lua implementation of nvim-hlchunk, you can use this neovim plugin to highlight your indent line and the current chunk (context) your cursor stayed
MIT License
472 stars 29 forks source link

Feel laggy when moving the cursor across multi-line comments in JavaScript #87

Closed nyngwang closed 2 months ago

nyngwang commented 5 months ago

Describe the bug As title. I need to investigate the output bundle, which is a js file with thousands of lines and containing some ugly comments inserted by webpack. (see below)

Whenever I move the cursor vertically across these lines it feels like neovim is frozen for 0.5 second or so. This also happens when I move the cursor horizontally on a line that has many asterisks.

To Reproduce Open a javascript file that contains some multi-line comments like this:

/***/ "./node_modules/@babel/runtime/regenerator/index.js":
/*!**********************************************************!*\
  !*** ./node_modules/@babel/runtime/regenerator/index.js ***!
  \**********************************************************/
/***/ (function(module, __unused_webpack_exports, __webpack_require__) {

Expected behavior No frozen

Screenshots Nope.

Additional context Nope.

nyngwang commented 5 months ago

Just found the culprit option line_num.enable. So turning off the line number feature solves this. I think it is still worth fixing it.

shellRaining commented 2 months ago

Just found the culprit option line_num.enable. So turning off the line number feature solves this. I think it is still worth fixing it.

This may be because the built-in searchpair function is relatively inefficient. maybe not fix... sorry

shellRaining commented 2 months ago

Added asynchronous processing in the dev branch, which should effectively alleviate the problem of lag. You can have a try. Temporarily close this issue, you can be reopened if necessary.