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

Parse provided tag #203

Merged
merged 4 commits into from
Oct 26, 2021
Merged

Parse provided tag #203

merged 4 commits into from
Oct 26, 2021

Conversation

sydneypalumbo
Copy link
Contributor

@sydneypalumbo sydneypalumbo commented Oct 26, 2021

An alternative to #202:

  • requires provided tag to be an expression
  • parses provided tag to find references / features and determine whether the tag makes the cell async
    • I just mainly took the parts of the CellParser relevant to determining async and created a super basic TagParser, but lmk if I'm misunderstanding the best way to do this 👍
  • should only require a minor version bump? this will require a major version change

Like the original PR this also:

  • will require a minor adjustment in the compiler so that it doesn't need to add the tag as an additional input
  • will require ui / next to handle references / databaseClients with null start and end positions (for nodes in the tag but not cell value)
  • adds a few tests

Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

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

I like this approach. I think we should expose the parsed AST for the tag too.

src/parse.js Outdated Show resolved Hide resolved
src/parse.js Show resolved Hide resolved
src/parse.js Outdated Show resolved Hide resolved
src/parse.js Outdated Show resolved Hide resolved
@sydneypalumbo
Copy link
Contributor Author

thanks @mbostock!! 🙏 updated this so that cell.tag is the parsed tag's AST that contains it's own async, generator, references and databaseClients / secrets / fileAttachments properties.

one thing I wasn't totally sure about was whether cell.async should be true if cell.tag.async is true (same for generator)... this currently does not override cell.async if cell.tag.async (and would instead require the caller to check the tag properties the same way it also has to check tag references + features) but let me know if you think it should 👍

Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

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

One last thing, let’s use CellTag as the name for these nodes instead of Tag?

src/parse.js Outdated Show resolved Hide resolved
src/parse.js Outdated Show resolved Hide resolved
@mbostock
Copy link
Member

I like the idea of keeping cell.async and cell.tag.async as independent because that doesn’t lose information and makes it easier for us to potentially do smarter things in the future.

Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

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

Looks good though one more tiny thing!

When you land would you like me to do the major version bump and publish to npm, or would you like me to pair with you so I can show you how to do it?

src/parse.js Outdated Show resolved Hide resolved
@sydneypalumbo
Copy link
Contributor Author

@mbostock if you have a sec to pair on it this afternoon that'd be great! 🙏

@sydneypalumbo sydneypalumbo merged commit b1a8984 into main Oct 26, 2021
@sydneypalumbo sydneypalumbo deleted the syd/parse-tag branch October 26, 2021 20:51
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.

2 participants