ExplainThisCode is A VSCode extension that uses the ChatGPT API to provide explanations for selected code.
-
The extension will explain the selected code in your VSCode editor and insert the explanation as a block comment above the code.
-
Run this extension using one of the following methods:
-
Keyboard shortcut:
- Windows and Linux: Ctrl + Alt + E
- macOS: Ctrl + Cmd + E
-
ETC
command in the command palette.
-
- A ChatGPT API key is required to use this extension.
There are two ways to install this extension:
-
From the Extension Marketplace: To install this extension from the Extension Marketplace in Visual Studio Code, search for ExplainThisCode and click the Install button.
-
Manually using a .vsix file: To install this extension manually using a .vsix file, follow these steps:
-
Download the .vsix file from the releases page on GitHub Releases
-
In Visual Studio Code, open the Command Palette (Ctrl+Shift+P)
-
Select "Extensions: Install from VSIX..." and select the .vsix file you just downloaded.
-
explainThisCode.apiKey
: ChatGPT API key to use with the extension.
To set the value of the explainThisCode.apiKey
extension setting:
-
Open the settings editor by selecting the
File
menu, thenPreferences
and thenSettings
, or by using the keyboard shortcutCtrl + ,
(Windows) orCommand + ,
(Mac). -
In the search bar at the top of the editor, search for
explainThisCode.apiKey
. -
Click on the
explainThisCode.apiKey
setting and enter your ChatGPT API key in the input field provided. -
Click the
Save
button to save your changes.
Alternatively, you can also set the value of the explainThisCode.apiKey
setting using the set()
function of the ConfigurationChangeEvent
class. For example:
vscode.workspace.getConfiguration().update('explainThisCode.apiKey', 'my-api-key', vscode.ConfigurationTarget.Global);
This will set the value of the explainThisCode.apiKey
setting to 'my-api-key'
for all workspaces.
- GPT-4 Integration: Benefit from the latest advancements in natural language processing, providing even more insightful and accurate code explanations.
- Initial release of the ETC extension.
- ChatGPT API: https://openai.com/docs/api-reference/overview/
This extension is licensed under the MIT License.
Telegram: @evyatar9
Discord: evyatar9
You can support my work buying me a coffee:
If you would like to contribute to the ETC extension, feel free to submit a pull request or report any issues you encounter on the ExplainThisCode repository.