Skip to content
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

Add newlines to histogram queries #2822

Merged
merged 2 commits into from
Jul 27, 2023
Merged

Add newlines to histogram queries #2822

merged 2 commits into from
Jul 27, 2023

Conversation

philrz
Copy link
Contributor

@philrz philrz commented Jul 26, 2023

The issue in #2819 looks to be a revisit of what we first saw in #2452. Like that issue, it seems the fix is as simple as adding a newline after the user's base query so that way the additional Zed that app tacks on will still be active even if the user's program ended with a comment.

Regarding coding style, I wasn't sure if indents were necessary to make it obvious that these string literals spanned multiple lines. However, the prior fix in #2519 didn't have indents and what I've got in this branch seems to pass the linter.

I've put down @nwt as an additional reviewer just to double check that there's no negative side effects we can think of from these newlines being added.

Here's the video evidence on this branch of the fix working for the three variations laid out in #2819

Verify.mp4

Note that I've not tried to dig into the "TypeError: Cannot add property 2000, object is not extensible" error I showed in #2819 since that's a bit beyond my expertise. As I expected, my fixes here seem to prevent that error from being triggered anymore, but maybe there's still something to look closer at there.

Fixes #2819

@philrz philrz requested review from nwt and jameskerr July 26, 2023 18:59
@philrz philrz self-assigned this Jul 26, 2023
Copy link
Member

@jameskerr jameskerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting!

Comment on lines 62 to 63
const query = `${baseQuery}
| ${timeField} == null | count()`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add a comment so no one unwittingly undoes this. And I think an escaped newline improves readability.

Suggested change
const query = `${baseQuery}
| ${timeField} == null | count()`
// Newline after baseQuery in case it ends with a comment.
const query = `${baseQuery}\n | ${timeField} == null | count()`

@philrz philrz merged commit 3d22e61 into main Jul 27, 2023
@philrz philrz deleted the philrz/issue2819 branch July 27, 2023 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Empty histogram when program closes with a comment
3 participants