GreenCode is a powerful Visual Studio Code extension that enhances your coding efficiency and promotes eco-friendly programming practices. It provides real-time insights into your code, highlighting opportunities for optimization and helping you write cleaner, more efficient code. Embrace cleaner coding practices that not only boost performance but also contribute to a greener planet.
GreenCode v0.1.2 introduces an advanced AI-driven feature for enhanced analysis and optimization of SQL queries. Leveraging the latest in artificial intelligence, GreenCode now offers deeper and more nuanced suggestions to improve your SQL queries, aligning them with green coding practices.
To utilize the AI-powered features, you need to provide your own OpenAI API key. This ensures the security and effective operation of the AI integration. Follow these steps to set up:
Obtain an API Key: Register at OpenAI and obtain an API key.
Configure an Environment Variable:
OPENAI_API_KEY
as the variable name and your OpenAI API key as the value.~/.bashrc
or ~/.zshrc
) and add: export OPENAI_API_KEY='your_api_key_here'
.source ~/.bashrc
(or the respective file for your shell).Restart Visual Studio Code to recognize the new environment variable.
While the AI-driven suggestions can significantly enhance code optimization, they should be used with caution:
By following these guidelines, you can effectively leverage the AI integration in GreenCode to improve your SQL queries while maintaining code integrity and performance.
GreenCode v0.1.1 introduces advanced capabilities to recursively search for Cartesian products within SQL queries. This improvement enables a more thorough and in-depth analysis of complex SQL statements, ensuring that even nested queries are scrutinized for potential optimizations.
The extension now features enhanced detection of inefficient patterns, such as LIKE
and NOT LIKE
operators. The analysis includes a broader range of operators between values, providing a more comprehensive assessment of potential performance issues.
With the new version, the message bar dynamically updates the count of high and medium severity issues whenever there is a change in the active document. This feature ensures that developers are always informed of the current state of their code, making it easier to track and address issues as they edit.
GreenCode offers an enhanced interactive experience with its severity navigation feature, significantly improving the way developers interact with the identified issues in their code.
GreenCode now offers an enhanced interactive experience with its severity navigation feature. This feature significantly improves the way developers interact with the identified issues in their code.
These enhancements are designed to streamline the optimization process, making it more efficient and user-friendly. By focusing on high-impact changes first and then addressing medium severity issues, developers can systematically improve their code’s performance and contribute to more sustainable software development practices.
GreenCode introduces several commands with convenient keybindings:
greencode.markDirtyCode
: Activates the extension. Keybinding: Shift + Ctrl + Alt + F
greencode.deactivateMarkDirtyCode
: Deactivates the extension. Keybinding: Shift + Ctrl + Alt + D
greencode.cleanMarkedCode
: Replaces identified issues with optimized code. Keybinding (works currently only for medium severity spots): Ctrl + Space
greencode.activateAI
: Activates the AI analysis on marked code. Keybinding: Ctrl + Alt + I (only active when code is marked for analysis)Shift + Ctrl + Alt + F
.Shift + Ctrl + Alt + D
if needed.Your contributions to improve GreenCode are highly appreciated. Whether it's bug reporting, feature suggestion, or code contribution, feel free to open an issue or submit a pull request on our GitHub repository.
GreenCode is made available under the MIT License.
GreenCode is developed with the aim of helping programmers write more efficient and environmentally responsible code, contributing to a greener and more sustainable future in software development.
For more information, visit our GitHub repository.
Owner
Contributors
Categories
Programming Languages
TypeScriptLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community