hlchunk.nvim icon indicating copy to clipboard operation
hlchunk.nvim copied to clipboard

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

Open nyngwang opened this issue 1 year ago • 1 comments

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 avatar Feb 03 '24 14:02 nyngwang

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.

nyngwang avatar Feb 03 '24 14:02 nyngwang

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 avatar May 26 '24 16:05 shellRaining

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.

shellRaining avatar May 27 '24 10:05 shellRaining