-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Debug Tag #1640
Debug Tag #1640
Conversation
Nice! I think the 'debug all changes' version should just be One small problem with extending from {#each things as thing}
{@debug somethingElseEntirely}
{/each} ...the debugger would trip for changes to Also, |
For
|
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.
this is great, thank you for working on this! I've created some tests in a separate branch — I wanted to make a PR against this branch but couldn't figure out how 😬 so feel free to just steal 'em
src/compile/nodes/DebugTag.ts
Outdated
|
||
const condition = [...dependencies].map(d => `changed.${d}`).join(' || '); | ||
|
||
const identifiers = [...dependencies].join(', '); |
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.
This doesn't quite work — the dependencies of an expression are the top-level data properties that it's ultimately derived from. So in this case...
{#each things as thing}
{@debug thing}
{/each}
...the identifier is thing
but the dependency is things
.
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.
ahh I see, so the conditional is things.changed
and then the ctx
is thing
?
src/compile/nodes/DebugTag.ts
Outdated
|
||
const identifiers = [...dependencies].join(', '); | ||
|
||
block.builders.update.addBlock(deindent` |
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.
we're missing the equivalent block (sans condition) for block.builders.create
😀
Makes sure that |
Thank you! I made a small tweak to the parser so that it handles single identifiers (i.e. |
Re: Issue #1635
Currently don't have a test case for nominal output, but that's planned for tomorrow night.
Just wanted to submit the PR so I could go to bed + get some feedback on it. Went with the
{@debug _ }
to represent "debug all changes" which may or may not be something we want. But I added it anyway just to give an idea of what it looks like currently.