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

Find "Find in editor" and value tooltips for decorated statements #2988

Merged
merged 6 commits into from Jan 20, 2024

Conversation

berekuk
Copy link
Collaborator

@berekuk berekuk commented Jan 19, 2024

No description provided.

@berekuk berekuk requested a review from OAGr as a code owner January 19, 2024 21:54
Copy link

changeset-bot bot commented Jan 19, 2024

🦋 Changeset detected

Latest commit: f1005e9

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

This PR includes changesets to release 6 packages
Name Type
@quri/squiggle-lang Patch
@quri/squiggle-components 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 Jan 19, 2024

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

Name Status Preview Updated (UTC)
quri-hub ✅ Ready (Inspect) Visit Preview Jan 20, 2024 1:11am
quri-ui ✅ Ready (Inspect) Visit Preview Jan 20, 2024 1:11am
squiggle-components ✅ Ready (Inspect) Visit Preview Jan 20, 2024 1:11am
squiggle-website ✅ Ready (Inspect) Visit Preview Jan 20, 2024 1:11am

);
}

export function undecorated(node: ASTNode) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Called "undecorated" and not "undecoratedStatement" because we'll get decorators for KeyValue pairs in dicts and other nodes soon.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe removeDecorations?

import { testRun } from "../helpers/helpers.js";

describe("SqValue.asJS", () => {
test("SqDict -> Map", async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

minor, but I don't get what this is meant to be testing. "Is instance of object" doesn't tell us much. Please improve the description or test.

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 didn't touch this code, just moved it (from public/SqValue_test.ts, which was becoming too long and unfocused).

The patch that caused the mismatch from the description is yours: 5c1f624

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, makes sense

@@ -39,3 +39,15 @@ export function expectErrorToBeBounded(
const error = distance / normalizingDenom;
expect(error).toBeLessThanOrEqual(epsilon);
}

export function assertTag<T extends SqValue["tag"]>(
Copy link
Contributor

@OAGr OAGr Jan 19, 2024

Choose a reason for hiding this comment

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

This is cute. I might change to assertSqValueTag or something. I thought this referred to our Tag system at first.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, it's annoying that native Jest tests don't act as TypeScript guards.

There's some slow progress on Jest and Typescript about that: jestjs/jest#9146, DefinitelyTyped/DefinitelyTyped#41179, microsoft/TypeScript#40562, but it's not quite there yet.

I thought this referred to our Tag system at first.

We probably should rename SqValue.tag -> SqValue.type...

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point

Copy link
Contributor

@OAGr OAGr left a comment

Choose a reason for hiding this comment

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

Code looks fine, but:

  1. I'm not sure what this does. Is it just refactoring, or does it fix things (I think it shows tooltips for decorator statements)? If it's the latter, I'd suggest adding a Changeset. (Either way, a description would have been useful)
  2. Tests are broken now, though that's not this one's fault. I think main is down.

* main:
  fix components tests by converting ts-jest to jest with babel
  Create stupid-bananas-look.md
  tests
  disallow Foo.bar and Foo as variable names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants