-
Notifications
You must be signed in to change notification settings - Fork 638
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
feat: add json definition generator functions #2188
Conversation
generator.valueToCode(block, 'TOOLTIP', Order.ATOMIC), | ||
); | ||
const helpUrl = JSON.parse( | ||
generator.valueToCode(block, 'HELPURL', Order.ATOMIC), |
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.
I've heard of trailing commas on object literals, but trailing commas on function parameters is new to me.
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.
yeah, this was a relatively recent change by the formatter. I think they used the same logic for trailing commas elsewhere and applied it to multiline function definitions as well (smaller diffs when adding or removing parameters, etc).
* | ||
* @param workspace Workspace to generate code from. | ||
*/ | ||
init(workspace: Blockly.Workspace) { |
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.
Do we want commented out code here? Over time the origin of this code will drift away from the commented out code. I'm not sure it can be trusted in the future.
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.
No, we don't. I'll remove it all before I merge this branch into develop. I just haven't gotten far enough along to where I know which parts I want to delete and which parts I actually want to uncomment. But I won't do the final merge with this in here
* feat: add basic infrastructure of developer-tools * chore: add eof newline where missing * fix: formatting, license, css attributes * feat: add block factory blocks and toolbox (#2155) * feat: add block factory blocks and toolbox * fix: pr comments * fix: change type to connection check * fix: formatting and comments * chore: lint and format developer-tools (#2185) * chore: autofix lint * chore: manually fix most of the lint * chore: format * feat: add basic saving and loading and start block state (#2187) * feat: add json definition generator (#2188) * feat: add javascript definition generators for blocks (#2196) * feat: add javascript definition generators for blocks * chore: format * fix: switch statement style Co-authored-by: Christopher Allen <[email protected]> * fix: update to latest blockly to use JavascriptGenerator class * fix: fix img dropdown option --------- Co-authored-by: Christopher Allen <[email protected]> * feat: add controllers and models to switch between definitions (#2219) * feat: add code header generation for imports and script tags (#2286) * feat: add save, load, and delete functionality to dev-tools (#2285) * feat: add save, load, and delete functionality to dev-tools * chore: format * chore: update load name * feat: add generator stubs to block factory (#2295) * feat: add generator stub generator and output * feat: add generator headers * chore: add more tsdoc * chore: minor refactoring of template strings * feat: save block factory settings (#2297) * feat: save block factory settings * chore: const to named functions * feat: add ability to convert old block factory json to new (#2304) * feat: add ability to convert old block factory json to new * chore: format and use constant * fix: use better typings, minor refactoring * feat: add shadow blocks for connection checks and real colour block (#2307) * feat: add file upload for block factory (#2320) * feat: add file upload for block factory * chore: fix questionable html formatting * chore: rename and comments * feat: add angle and colour fields to block factory (#2325) * feat: add angle and colour fields to block factory * fix: call register fields in script header * feat: support uploading file from old block factory (#2336) * feat: support uploading file from old block factory * feat: support multiple file input, minor pr fixes * feat: update to blockly v11 & improve style (#2388) * fix: styling * fix: changes for v11 * fix: set max height in narrow mode * fix: min height of code divs * chore: format * chore: remove log * feat: use a js legal name for the block in code output (#2392) * feat: use a js legal name for the block in code output * fix: legal js name probably * feat: add help button and favicon (#2396) * feat: include developer-tools when publishing to gh-pages (#2395) --------- Co-authored-by: Christopher Allen <[email protected]>
The basics
The details
Resolves
Works on Block Factory
Proposed Changes
blocks/type.ts
file toblocks/connection_check.ts
to match the new name which was renamed in a previous PRThis PR depends on #2187 , but only barely. It's only the changes in
index.ts
and I'm adding to the change listener that was added in that PR. So you can still review this PR for content and I'll rebase when that PR goes in. The bulk of this PR is not dependent on that one.Note that many parts of the
JsonDefinitionGenerator
are commented out. I plan to clean this up once I've written a) the other types of generators and b) implemented checking the block name doesn't conflict with a different block name and is a valid json identifier, which I am hoping to use the machinery for valid names in generators to do so. So I will need parts that are currently commented out and others I am not sure about yet. I got the bulk of this code from copying thejavascriptGenerator
from core and modifying as needed.Reason for Changes
Test Coverage
Manual testing. I've started working on an automated test that would exercise this generator but there's no mechanism for running tests in
examples/
right now so that's a bigger project and in a different PR.Documentation
Additional Information