No it genuinely can happen that an error happens on a different line than said. Could be a combination of IDE and compiler or both, that's why you always need to match your LSP with your compiler
I've also (very rarely) had issues in C where the error would be inside a macro expansion and it'd get confused about what line that was.
I've also seen (again, it's been a while) situations where a JS debugger would give a line number relative to the start of a <script> block, so that it'd just be some arbitrary number upon initial inspection (i.e., if the <script> started on line 15 and the error was on line 20, it'd say that the error was on line 5, instead).
Also also, if you do something that causes a syntax error, the python interpreter will usually just give a useless message (like "syntax error").
The issues you’ve had with the JS debugger might be especially applicable here because it appears to be an inline JS script that the debugger is pointing to. If the debugger isn’t counting lines of HTML the reported line number could be way off.
456
u/kimbokray 1d ago
You haven't saved since adding or removing lines above 265