
Code-to-Gist 🤖
This extension allows you to conveniently create and share GitHub Gists from your code files directly within the editor. Gists are a way to share snippets or larger portions of code with others, either as a public or secret gist, making it easy to collaborate or showcase your work.
Features 📙
Create GitHub Gists: Create Gists by posting code files from your local VS Code environment to GitHub's Gist service.
GitHub PAT: To authenticate with GitHub and create Gists, you'll need to provide a GitHub PAT (Personal Access Token), ensuring secure and authorized access, you can get that via your GitHub profile settings.
File Selection: Choose specific code files to include in the Gist by selecting them through the file picker within the VS Code interface.
Public or Private Gists: You can decide whether your Gist should be public or private, allowing you to control who can access and view your code snippets for safer collaboration.
Installation 📝
- Launch Visual Studio Code.
- Go to the Extensions view by clicking on the square icon on the left sidebar or by using the shortcut
Ctrl+Shift+X .
- Search for "Code-to-Gist" in the Extensions marketplace.
- Click the "Install" button next to the "Code-to-Gist" extension.
- Once installed, you can find the extension using
Cmd+Shift+P or at the bottom left of your VSCode as Create Gist
Usage 🛠️
Open Visual Studio Code and open a workspace/project folder.
Choose a method to create a Gist: There are multiple ways to create a Gist using the code-to-gist extension:
Create Gist from Active Editor: This method allows you to create a Gist from the currently active file in your editor. To use this method, ensure the file you want to share is open and active. Then, use the Cmd+Shift+P shortcut, search for "Code-To-Gist: Create GitHub Gist from Active Editor" , and select it.
Create Gist from Explorer: This method allows you to create a Gist from a file selected in the Explorer view. To use this method, navigate to the file you want to share in the Explorer view, right-click on it, and select "Code-To-Gist: Create GitHub Gist from Explorer" .
Create Gist using File Picker: This method allows you to create a Gist using a file picker dialog. To use this method, use the Cmd+Shift+P shortcut, search for "Code-To-Gist: Create GitHub Gist using File Picker" , and select it. A file picker popup will appear, allowing you to navigate to and select the file or files you want to share as a Gist.
Create Gist from Selection: This method allows you to create a Gist from a selected portion of code in your editor. To use this method, highlight the portion of code you want to share in your editor, then use the Cmd+Shift+P shortcut, search for "Code-To-Gist: Create GitHub Gist from Selection" , and select it.
Follow the on-screen prompts to authenticate, select files, and set the visibility of your Gist.
The extension will handle the creation of the Gist and display a success message with the URL of the created Gist at the bottom right corner of your code editor.
If you choose to go to the Gist, it will open up in your default browser.
In case of any errors or issues, appropriate error messages will be displayed, indicating the problem encountered. Refer to the #Troubleshooting section of this docs and try to fix the issue based on the error message. If the error persists, please reach out to me via Twitter DM (@developerayo).
Extension Deactivation 😔
The extension is deactivated automatically when you close Visual Studio Code or manually disable the extension in the Extensions view.
Troubleshooting 🐛
- Error: "GitHub authentication failed": Ensure that you are successfully authenticated with your GitHub account in your VSCode session. If not, the Code-To-Gist extension cannot authenticate and create Gists.
- Error: "Please select a file": Make sure you select at least one code file to include in the Gist when the file picker opens. You can select multiple files by using
Cmd + Click .
- Error: "Rate limit exceeded. Please try again later.": GitHub imposes rate limits on API requests. If you encounter this error, you'll have to wait for some time before trying to create a new Gist again.
- Error: "Invalid GitHub PAT. Please check your token.": This error should not appear unless there is a change in the GitHub authentication method provided by VSCode. If you do encounter it, verify that you're properly authenticated on your VSCode session.
- Error: "Please select a gist visibility": Make sure to select either 'public' or 'secret' when asked for the visibility of the Gist.
- Error: "Failed to create a gist: [Error Message]" or "An unexpected error occurred while creating a gist": These are general error messages. Look at the provided error details for hints on what went wrong. If the error persists, reach out for help via Twitter DM (@developerayo).
Feedback and Contributions 👂
If you have any feedback, suggestions, or bug reports, please reach out to me on Twitter (@developerayo)
Enjoy! 🧡
| |