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

Add autocomplete support to the canvas graphics module #380

Merged
merged 9 commits into from
Jan 24, 2025

Conversation

neilccbrown
Copy link
Collaborator

The diff for graphics.py seems to be quite screwed up; it shows me removing a bunch of code and re-adding it but really I just inserted some bits in the middle. The overall aim of this PR is to add code completion support to the canvas-graphics branch, based on the recent switch to TigerPython autocomplete in the main branch. We add some special type annotations in comments, then we have some code to extract these annotations and feed them to TigerPython, so for example it knows that load_image returns an EditableImage. We only need the annotations for return types, not parameters, as we don't need those for autocomplete. The new raw-loader library lets us load the .py files directly in Typescript.

…Strype's libraries because it couldn't load the internal libraries.
…aspects:

 - We need to load graphics.py to process it so I use webpack's support for loading text files at import-time.
 - Then we extract types from this file (added to the file in this commit) in the format TigerPython expects.

 And that's all we need to do.  Then we have support in the autocomplete for the graphics types.
@neilccbrown neilccbrown requested a review from PwtKCL January 23, 2025 09:15
@PwtKCL
Copy link
Collaborator

PwtKCL commented Jan 23, 2025

Code-wise I think the branch can be merged. There is one test failing that seems unrelated to the new tests added, so it shouldn't be too complex to sort.
I suggest to commit a fix for the tests to pass, if possible, then the PR can be merged fine.

@PwtKCL PwtKCL merged commit d27a865 into k-pet-group:canvas-graphics Jan 24, 2025
1 check passed
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