GitHub Discussions for VS Code

View, create, edit, and manage GitHub Discussions directly within VS Code using a Virtual File System approach.
Features
- Sidebar Tree View - Browse discussions organized by category
- Virtual File System - Edit discussions as markdown files (
ghd:// URI scheme)
- Rich Preview - View discussions with full markdown rendering and Mermaid diagram support
- Create & Edit - Create new discussions and edit existing ones without leaving VS Code
- Comments View - View and navigate discussion comments
- Auto Refresh - Automatically sync with GitHub at configurable intervals
- Open in Browser - Quick access to discussions on GitHub
Getting Started
- Install the extension from the VS Code Marketplace
- Open a folder containing a Git repository with GitHub Discussions enabled
- Click the GitHub Discussions icon in the Activity Bar
- Click Sign in to GitHub when prompted
- Start browsing and editing your discussions
Requirements
- VS Code 1.105.0 or higher
- A GitHub repository with Discussions enabled
- GitHub authentication (the extension uses VS Code's built-in GitHub authentication)
Commands
All commands are accessible via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command |
Description |
GitHub Discussions: Sign in to GitHub |
Authenticate with GitHub |
GitHub Discussions: Refresh |
Manually refresh the discussions list |
GitHub Discussions: Create Discussion |
Create a new discussion |
GitHub Discussions: Edit Discussion |
Edit a discussion |
GitHub Discussions: View Comments |
View comments on a discussion |
GitHub Discussions: Open in Browser |
Open the discussion on GitHub |
Extension Settings
This extension contributes the following settings:
| Setting |
Default |
Description |
github-discussions.autoRefresh |
true |
Automatically refresh discussions |
github-discussions.refreshInterval |
300000 |
Refresh interval in milliseconds (default: 5 minutes) |
github-discussions.showNotifications |
true |
Show notifications for discussion updates |
github-discussions.defaultSort |
"newest" |
Default sort order (newest, oldest, top) |
github-discussions.defaultCategory |
"general" |
Default category for new discussions |
github-discussions.pageSize |
10 |
Number of discussions to load per page (1-100) |
Example Configuration
{
"github-discussions.autoRefresh": true,
"github-discussions.refreshInterval": 600000,
"github-discussions.defaultSort": "top",
"github-discussions.defaultCategory": "Q&A",
"github-discussions.pageSize": 20
}
How It Works
The extension uses a Virtual File System to expose GitHub Discussions as editable markdown files:
ghd://discussions/{number}/{title}.md
When you save changes to a discussion file, the extension automatically syncs your edits back to GitHub via the GraphQL API.
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ VS Code │
├─────────────────────────────────────────────────────────────────┤
│ Activity Bar │ Editor Area │ Sidebar │
│ ┌───────────┐ │ ┌───────────┐ │ ┌────────────────┐ │
│ │ Discussions│ │ │ ghd://... │ │ │ Tree View │ │
│ │ Icon │ │ │ .md file │ │ │ - Category 1 │ │
│ └───────────┘ │ │ │ │ │ - Discussion │ │
│ │ │ │ │ │ - Discussion │ │
│ │ └───────────┘ │ │ - Category 2 │ │
│ │ │ │ - Discussion │ │
│ │ │ └────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────┐
│ GitHub GraphQL │
│ API │
└─────────────────┘
Data Flow
- Authenticate via VS Code's built-in GitHub auth (scopes:
repo, read:user)
- Fetch discussions via GitHub GraphQL API
- Display discussions in the sidebar tree view grouped by category
- Open discussions as virtual markdown files for editing
- Sync changes back to GitHub on save
Known Issues
- Discussions from private repositories require appropriate GitHub permissions
- Large discussions with many comments may take longer to load
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Development Setup
# Clone the repository
git clone https://github.com/manaty226/vscode-gh-discussions.git
cd vscode-gh-discussions
# Install dependencies
npm install
# Compile the extension
npm run compile
# Run tests
npm test
# Package the extension
npm run package
Available Scripts
| Script |
Description |
npm test |
Run Jest unit tests |
npm run test:watch |
Run tests in watch mode |
npm run test:coverage |
Run tests with coverage report |
npm run compile |
Compile TypeScript |
npm run watch |
Watch mode compilation |
npm run lint |
Check code style with ESLint |
npm run lint:fix |
Auto-fix linting issues |
npm run package |
Create .vsix extension package |
Project Structure
src/
├── extension.ts # Main entry point
├── providers/ # Presentation layer
│ ├── DiscussionsProvider.ts # Tree view for sidebar
│ ├── DiscussionFileSystemProvider.ts # Virtual FS (ghd://)
│ └── WebviewProvider.ts # Rich markdown rendering
├── services/ # Business logic layer
│ ├── AuthenticationService.ts # GitHub auth integration
│ ├── GitHubService.ts # GraphQL API communication
│ ├── AutoRefreshService.ts # Background updates
│ ├── CacheService.ts # In-memory caching
│ └── StorageService.ts # Persistent storage
├── models/ # Data models
└── utils/ # Utility functions
Release Notes
2.0.0
- Virtual File System support for editing discussions
- Rich markdown preview with Mermaid diagram support
- Auto-refresh functionality
- Category-based organization
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Enjoy managing your GitHub Discussions directly in VS Code!