feat: Add VSCode extension for live coding in Python#777
Open
TaliesinYang wants to merge 3 commits into
Open
Conversation
Python 3.14's turtle.py references tk.PhotoImage in TurtleScreen.__init__, which fails when tkinter is not available (e.g., headless environments). Adding PhotoImage to the mock objects allows space_tracer to work on any Python version without requiring tkinter. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a new VSCode extension that brings live coding support to VS Code, matching the PyCharm plugin's core features: - Split view: source code on left, trace output on right - Auto-detection: automatically switches between text and canvas mode - Turtle graphics: renders turtle drawings in a Webview panel - Matplotlib: displays plots via canvas commands - Scroll sync: PyCharm-style leader-follower synchronization - File following: auto re-traces when switching Python files - Custom turtle icon in editor title bar - Keyboard shortcuts: Cmd+Shift+L (start), Cmd+Shift+K (stop) - CodeLens: clickable "Start Live Coding" link at file top - Configurable: Python path, debounce, canvas size, driver, traced module - Bundled space_tracer: works out of the box, no pip install needed - E2E tests with @vscode/test-electron Closes donkirkby#218 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- contributing-vscode.md: development setup, architecture, testing, packaging - docs/starting_vscode.md: user guide with examples for trace, turtle, matplotlib - CONTRIBUTING.md: add VS Code entry to development environments list Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Owner
|
This is a great start! I see you got both modes working. Are you interested in continuing, or shall I take it from here? Next steps:
Let me know if any of those interest you, otherwise I'll merge your changes and create new issues for myself. Thanks again for coming to the sprint! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tk.PhotoImagemock inmock_turtle.py)space_tracer— works out of the box withoutpip installFeatures
Architecture
Follows the same pattern as the Sublime and Emacs plugins:
space_traceras a subprocess via stdin/stdoutKey files:
vscode/src/extension.ts— session management, commands, scroll syncvscode/src/tracerManager.ts— subprocess lifecycle, debounce, Python detectionvscode/src/canvasPanel.ts— Webview Canvas rendering (turtle/matplotlib)vscode/src/canvasParser.ts— canvas command parser (ported fromhtml/src/SampleAnalyst.js)Test plan
npm run compile— zero errorsnpm test— E2E tests pass (extension activation, split view, trace output, file switching)Screenshots
Tested via code-server with Playwright automation.
Closes #218
🤖 Generated with Claude Code