-
Notifications
You must be signed in to change notification settings - Fork 827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight erroring line #954
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@samdev-7 is attempting to deploy a commit to the Hack Club Team on Vercel. A member of the Team first needs to authorize it. |
My general thoughts on this are there could be a few comments added to explain the magic tricks being performed in this code. That being said, this definitely attempts to solve a very real problem effecting users. Would suggest the PR author to exercise the editor a bit w/ different error scenarios to see if this change reacts well to them. Will merge when additional requested comments are added clarifying what some of these functions do. |
@grymmy I've tried adding more comments, most of the modified code is adapted from V1. I'm unsure how comments should be styled with Sprig, so please let me know if I did anything wrong. Regarding testing, I've tried it what I can think of. Please do use the deployed preview to test out edge cases if you come up with any, thanks! |
Update: It seems to have issues with nesting anonymous functions. Interestingly, the error line code detects the correct line, but somehow failes to apply the highlight. |
Apologies for the notification spam, I've attempted a fix. That error is normalized here and not the usual location, so it was missed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
} | ||
} else { | ||
return { description: `Runtime Error: ${gameError.error}`, raw: gameError.error } | ||
} | ||
} | ||
|
||
function findErrorLineCol(stack: string | undefined): [number | null, number | null] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a comment that explains what this function does at a high level?
src/lib/engine/3-editor/error.ts
Outdated
|
||
let line = null | ||
let col = null | ||
let location = stack.match(/<anonymous>:(.+)\)/) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a comment that explains what this function does at a high level?
} | ||
|
||
|
||
export function highlightError(line: number) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please add a comment that explains what this function does at a high level?
@samdev-7 Okay to merge after you resolve the remaining conflict in the PR. |
@grymmy I have attempted to elaborate regarding comments and the merge conflicts have been resolved. Let me know if issues still persist. |
Uses a similar (janky) method to UI V1, finds and highlights the erroring line.
Resolves #797.
Examples: