Add Autocomplete and Syntax Highlighting#109
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the code editing experience by integrating autocomplete and syntax highlighting features for Python. It introduces a new Conductor plugin that dynamically generates and utilizes autocomplete data from existing documentation, while also providing robust syntax highlighting based on Python's grammar. These additions aim to make coding more efficient and less error-prone by offering real-time suggestions and improved code readability. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant new feature: autocomplete and syntax highlighting for Python code. The implementation is comprehensive, involving a new Conductor plugin, code parsing with @lezer/python, and dynamic generation of syntax highlighting rules for the Ace editor. The approach is well-structured. I've identified a few issues, including a potential script failure, a hardcoded language variant, a leftover debug statement, a potential security vulnerability related to HTML injection, and a minor maintainability improvement. Overall, this is a great addition, and addressing these points will make it even more robust.
|
|
||
| # Process every JavaScript file in the docs/lib directory with JSDoc, | ||
| # outputting the AST as JSON to the src/conductor/plugins/autocomplete/builtins directory. | ||
| for file in "$LIB"/*.js; do |
There was a problem hiding this comment.
…as their own suggestion
…xpanded equality + mismatched name in Python 4 stdlib)
Each PyCseEvaluator variant registers its own autocomplete plugin with
the correct variant number and evaluator name, so the runner emits a
unique ace mode id (ace/mode/PyCseEvaluator{1..4}) per bundle.
docs/lib/*.jssrc/conductor/plugins/autocomplete/index.ts@lezer/pythonPaired PR: source-academy/frontend#3828
Things left to do:
def xwould showxas an autocomplete promptgetNamesandextractEnvironment