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

Truncate long VArray.toString values #3440

Merged
merged 3 commits into from
Nov 15, 2024
Merged

Conversation

berekuk
Copy link
Collaborator

@berekuk berekuk commented Nov 15, 2024

Before:

Screenshot 2024-11-15 at 15 26 25

After:

Screenshot 2024-11-15 at 15 26 37

This fixes long errors only for arrays; it's possible for similar errors to happen with dicts, but I've never encountered it so far.

I've also added a space after each comma, which forced me to upgrade all tests.
(previous stringification was inconsistent, we had spaces in dicts)

@berekuk berekuk requested a review from OAGr as a code owner November 15, 2024 18:27
Copy link

changeset-bot bot commented Nov 15, 2024

🦋 Changeset detected

Latest commit: 2bcdf71

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@quri/squiggle-lang Patch
@quri/squiggle-ai Patch
@quri/squiggle-components Patch
@quri/content Patch
@quri/prettier-plugin-squiggle Patch
@quri/versioned-squiggle-components Patch
vscode-squiggle Patch
@quri/squiggle-textmate-grammar Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Nov 15, 2024 7:11pm
squiggle-components ✅ Ready (Inspect) Visit Preview Nov 15, 2024 7:11pm
squiggle-website ✅ Ready (Inspect) Visit Preview Nov 15, 2024 7:11pm
1 Skipped Deployment
Name Status Preview Updated (UTC)
quri-ui ⬜️ Ignored (Inspect) Visit Preview Nov 15, 2024 7:11pm

@@ -27,7 +27,34 @@ export class VArray
}

valueToString() {
return "[" + this.value.map((v) => v.toString()).join(",") + "]";
// For reference, for long types TypeScript returns the following error:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the documentation of this could be improved a fair bit. I asked o1 to do an attempt, a quick look to me makes that seem a fair bit better.

https://chatgpt.com/share/673799fd-d5f4-8003-8cbd-137896284080

Copy link
Contributor

@OAGr OAGr Nov 15, 2024

Choose a reason for hiding this comment

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

The functionality of this seems good to me now. Just the documentation / variable naming that I think could use a bit of cleanup.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added more comments, hope this is good enough now.

(btw, o1 code is broken in at least one way, it could skip the first element; also, its comments don't match the code bahavior)

@OAGr OAGr merged commit 034e126 into main Nov 15, 2024
6 checks passed
@OAGr OAGr deleted the truncate-long-varray-strings branch November 15, 2024 19:23
@github-actions github-actions bot mentioned this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants