p5.js-web-editor
p5.js-web-editor copied to clipboard
Editor not helping: Bug
When using the Editor with auto-refresh checked, in a js library I have created (in the editor)... in my case app.js.
...when I type a mistake or have as yet unfinished code, the editor flags this up but I'm jumped to the sketch.js file, and so, often I'm in the middle of writing the code, and I add nonsense to a random point in my sketch.js file.
Thank you for reporting! I think this has to do with a new feature I added to highlight runtime errors. Would you mind posting a link to the sketch that this is happening in?
Would you also be able to write out the steps to reproduce this bug (e.g. 1. Open a new sketch, 2. create a file called 'app.js', etc.)? Thank you so much!
I think I just ran into this issue myself, where a runtime error was thrown in sketch.js because of a dependency on another file:
- Open the default sketch
- Add an
other.js
file and a<script>
to include it before thesketch.js
include - Add
blah = () => {}
toother.js
- In
setup
insketch.js
, add a call to theblah()
function - Back in
other.js
, removeblah
or redefineblah
to no longer be a function. When auto-run, a runtime error is thrown at the call site insketch.js
, so the editor switches tosketch.js
Let me know if this isn't the same problem
That's exactly the problem. @anderoonies
And what happens is, you go to fix the error and you type at some random spot (sometimes below the scroll) and all of a sudden you have two problem files, the one you coded a bug in an the one that has the first few chars of what you'd started to type at a random spot.
So bad, I had to stop using the Editor completely.
Seems like a tricky problem, since the error really is in the other file. Maybe if file switching for runtime errors waits for you to stop typing of Auto-refresh is on, but that’s a pretty fuzzy metric
On Mon, Nov 29, 2021 at 4:24 AM everythingability @.***> wrote:
That's exactly the problem. @anderoonies https://github.com/anderoonies
And what happens is, you go to fix the error and you type at some random spot (sometimes below the scroll) and all of a sudden you have two problem files, the one you coded a bug in an the one that has the first few chars of what you'd started to type at a random spot.
So bad, I had to stop using the Editor completely.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/processing/p5.js-web-editor/issues/1976#issuecomment-981586957, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSWLALVUOW6DFIYQXOZULTUONWIPANCNFSM5IJPQEJA .
No it isnt.
The error isn't in another file if in your main sketch.js it calls a doThis() function, which is in another file... let's call it dothis.js.
So I'm editing code in dothis.js and I make a mistake, the error then JUMPS back to sketch.js where doThis() is called... and tap-tap-tap... there are now letters I'd started typing whilst in the doThis() function in sketch.js.
One "solution" might be to show the error (with a link to where it thinks the error is) and nothing else (whilst still polling the code as I type) and if the code eventually runs, hide the error.
(But I know NOTHING about how the Editor works and if this is just fantasy).
Cheers for trying though.
Hi! As we're currently in the process of organizing issues and discussions, I'm going to close this issue since might not plan to focus on this in the near future. Thanks for your understanding and please feel free to reopen this or create a new one!