-
Notifications
You must be signed in to change notification settings - Fork 49.7k
[compiler] Improve display of errors on multi-line expressions #34963
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
Conversation
| 0, | ||
| CODEFRAME_LINES_ABOVE + CODEFRAME_ABBREVIATED_SOURCE_LINES, | ||
| ), | ||
| '> ' + ' '.repeat(pipeIndex - 2) + '…', |
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.
nit: should we add the pipe index here?
Currently we have
2 | function Component(props) {
> 3 | const data = useMemo(() => {
| ^^^^^^^
> …
> 7 | }, [props.items?.edges?.nodes]);
| ^^^^ Could not preserve existing manual memoization
Would it look better as this?
2 | function Component(props) {
> 3 | const data = useMemo(() => {
| ^^^^^^^
> | …
> 7 | }, [props.items?.edges?.nodes]);
| ^^^^ Could not preserve existing manual memoization
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.
I originally did that, but it looks weird since the ellipsis isn't indented propery. I like the ellipsis in place of the pipe to show it's not continuous. 🤷♂️
| 0, | ||
| CODEFRAME_LINES_ABOVE + CODEFRAME_ABBREVIATED_SOURCE_LINES, | ||
| ), | ||
| '> ' + ' '.repeat(pipeIndex - 2) + '…', |
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.
| '> ' + ' '.repeat(pipeIndex - 2) + '…', | |
| '> ' + ' '.repeat(pipeIndex - 2) + '| …', |
When a longer function or expression is identified as the source of an error, we currently print the entire expression in our error message. This is because we delegate to a Babel helper to print codeframes. Here, we add some checking and abbreviate the result if it spans too many lines.
|
Closes #34795 |
When a longer function or expression is identified as the source of an error, we currently print the entire expression in our error message. This is because we delegate to a Babel helper to print codeframes. Here, we add some checking and abbreviate the result if it spans too many lines. DiffTrain build for [408b38e](408b38e)
When a longer function or expression is identified as the source of an error, we currently print the entire expression in our error message. This is because we delegate to a Babel helper to print codeframes. Here, we add some checking and abbreviate the result if it spans too many lines. DiffTrain build for [408b38e](408b38e)
…ook#34963) When a longer function or expression is identified as the source of an error, we currently print the entire expression in our error message. This is because we delegate to a Babel helper to print codeframes. Here, we add some checking and abbreviate the result if it spans too many lines. DiffTrain build for [408b38e](facebook@408b38e)
…ook#34963) When a longer function or expression is identified as the source of an error, we currently print the entire expression in our error message. This is because we delegate to a Babel helper to print codeframes. Here, we add some checking and abbreviate the result if it spans too many lines. DiffTrain build for [408b38e](facebook@408b38e)
When a longer function or expression is identified as the source of an error, we currently print the entire expression in our error message. This is because we delegate to a Babel helper to print codeframes. Here, we add some checking and abbreviate the result if it spans too many lines.