locatorjs icon indicating copy to clipboard operation
locatorjs copied to clipboard

The located source line is wrong, needs to plus 1.

Open Mongkii opened this issue 1 year ago • 1 comments

Where the bug happens

  • [X] Browser Extension
  • [ ] Library
  • [ ] Other

your browser

No response

Describe the bug

The code line number that attached to component is 1-line less than the line number in editor.

e.g. The component lies on line 17 in editor, but the line info attached to it is line 16.

It's because line number in editor is 1-based, whereas in compile tools is 0-based.

Jumping to source with compilation line number will result in one line ahead of editor line number. It'd be great if the line number were corrected before jumping to source.

To reproduce

Use vite to create a project with default React boilerplate. (https://vitejs.dev/guide/)

Run in dev, and use Locator.js to locate component.

Additional information

No response

Mongkii avatar Feb 01 '23 05:02 Mongkii

just tested it, and I see that in the latest version of Vite (React, Typescript, without SWC) it is one line off, but in the same version with SWC it is correct. Also in some older versions of Vite, I always had it right 🤔

infi-pc avatar Feb 02 '23 15:02 infi-pc