This is a Visual Studio Code extension for ChatGPT that was built using only ChatGPT and 5 beers.
The README.md
file for this extension was generated by ChatGPT.
- Login with your ChatGPT access token
- Ask ChatGPT any question and supply source code from your current file/selection
- Ask ChatGPT to refactor your code and explain the changes
- Ask ChatGPT for help explaining code
- Ask ChatGPT for help troubleshooting code
- Clear logs/output from ChatGPT
To use the extension:
This package requires a valid session token from ChatGPT to access it's unofficial REST API.
Open the VS Code Command Palette and Type ChatGPT: Login
, this will prompt you for your session token.
To get a session token:
- Go to https://chat.openai.com/chat and log in or sign up.
- Open dev tools.
- Open
Application
>Cookies
(Storage
>Cookies
on FireFox)
- Copy the value for
__Secure-next-auth.session-token
and enter it into the prompt fromChatGPT: Login
Once you're logged in, you can ask ChatGPT any question and supply source code from your current file/selection.
The commands are:
ChatGPT: Ask ChatGPT
(will provide a prompt for you to ask a question)ChatGPT: Why is my code broken?
ChatGPT: Explain this code
ChatGPT: Refactor this code
ChatGPT: Clear ChatGPT Logs
(clears down responses stored in MD file)
To install the extension, follow these steps:
- Open Visual Studio Code
- Click on the Extensions icon in the left sidebar
- Search for "ChatGPT VSCode plugin"
- Click on the Install button to install the extension
- Click on the Reload button to activate the extension
If you need help using this extension, please open an issue on the GitHub repository for this extension.
- ChatGPT - The large language model trained by OpenAI that was used to generate this README file
- chatgpt-api - The NPM package used to query ChatGPT
- Yeoman - The code generator used to scaffold the extension project
- VS Code Extension Generator - The Yeoman generator for creating VS Code extensions