Share code snippets directly to Twitter/X from VS Code.
- Share selected code with a right-click
- Preview and edit tweets before posting
- Dark mode support
- Character count validation
- Secure credential management
You need an X (formerly Twitter) developer account and OAuth 1.0 credentials to use this extension (docs)
- Create a developer account
- Create an app
- Generate consumer keys and access tokens
Install the extension from the VS Code marketplace(almost there!)- Right-click on any code selection and choose "Tweet Selection"
- Click "Disconnected" to create a
.twitter-credentials
file - Add your X API credentials to the file:
{
"consumerKey": "your-consumer-key",
"consumerSecret": "your-consumer-secret",
"accessToken": "your-access-token",
"accessSecret": "your-access-secret"
}
Alternative: Clone this repository and run the following commands:
cd tweet-code
bun install
chmod +x scripts/publish-local.sh
./scripts/publish-local.sh
- Select code in your editor
- Right-click and choose "Tweet Selection"
- Edit your tweet if needed
- Click "Post Tweet"
Alternative: Use the command palette (Cmd/Ctrl + Shift + P
) and search for "Tweet Code: Share"
Your X credentials are stored locally in your workspace. Never commit the .twitter-credentials
file to version control.
Pull requests are welcome! I made this extension for personal consumption, so issues will be considered without SLA.
MIT