A modern VS Code extension with a beautiful login interface built using React and TypeScript.
handit-login-extension/
├── 📁 src/ # Extension source code
│ ├── 📄 extension.ts # Main extension entry point
│ └── 📄 loginPanelProvider.ts # Webview provider
├── 📁 webview/ # React webview application
│ ├── 📁 src/ # React source code
│ │ ├── 📄 App.tsx # Main React component
│ │ ├── 📄 main.tsx # React entry point
│ │ ├── 📄 styles.css # Global styles
│ │ ├── 📁 components/ # React components
│ │ │ └── 📄 LoginForm.tsx # Login form component
│ │ └── 📁 hooks/ # Custom React hooks
│ │ └── 📄 useVSCode.ts # VS Code integration hook
│ ├── 📁 dist/ # Built webview files
│ ├── 📄 package.json # Webview dependencies
│ ├── 📄 vite.config.ts # Vite configuration
│ └── 📄 tsconfig.json # TypeScript config
├── 📁 .vscode/ # VS Code configuration
│ ├── 📄 launch.json # Debug configuration
│ └── 📄 tasks.json # Build tasks
├── 📁 out/ # Compiled extension files
├── 📄 package.json # Extension manifest
├── 📄 tsconfig.json # TypeScript configuration
├── 📄 .eslintrc.json # ESLint configuration
└── 📄 .vscodeignore # Files to ignore in package
- Modern Login UI: Beautiful, responsive login form with VS Code theme integration
- VS Code Integration: Seamless communication between webview and extension
- TypeScript: Full type safety throughout the codebase
- React 18: Modern React with hooks and functional components
- Vite Build: Fast development and optimized production builds
- Theme Support: Automatically adapts to VS Code light/dark themes
- Form Validation: Client-side validation with error handling
- Loading States: Smooth loading indicators and disabled states
- Social Login: UI for Google and GitHub authentication (UI only)
- Node.js 16+
- VS Code 1.74+
- npm or yarn
-
Install extension dependencies:
npm install
-
Install webview dependencies:
cd webview npm install cd ..
-
Build the webview:
npm run build-webview
-
Compile the extension:
npm run compile
-
Start webview development server:
npm run dev-webview
-
Enable development mode in VS Code:
- Open VS Code settings
- Search for "handitLogin.devMode"
- Set to
true
-
Run the extension:
- Press
F5or useCmd+Shift+P→ "Debug: Start Debugging" - This opens a new "Extension Development Host" window
- Press
npm run compile- Compile TypeScript to JavaScriptnpm run watch- Compile in watch modenpm run build-webview- Build React webview for productionnpm run dev-webview- Start webview development servernpm run lint- Run ESLint
npm run dev- Start Vite development servernpm run build- Build for productionnpm run preview- Preview production build
- Email Input: With validation and error states
- Password Input: With show/hide toggle
- Remember Me: Checkbox for persistent login
- Forgot Password: Link for password recovery
- Sign In Button: With loading state and spinner
- Social Login: Google and GitHub buttons (UI only)
- Theme Support: Automatically adapts to VS Code themes
- Message Passing: Bidirectional communication with extension
- Responsive Design: Works on different panel sizes
- Accessibility: Proper ARIA labels and keyboard navigation
- CSS Variables: Uses VS Code theme variables
- Modern Design: Clean, professional appearance
- Smooth Animations: Hover effects and transitions
- High Contrast: Support for high contrast mode
The extension provides the following settings:
handitLogin.apiUrl(string): API URL for Handit services (default: "https://api.handit.ai")handitLogin.devMode(boolean): Enable development mode for webview (default: false)
- Development Mode: Webview loads from
http://localhost:5173for hot reload - Production Mode: Webview loads from bundled files in
webview/dist/
To create a VS Code extension package:
-
Install vsce:
npm install -g vsce
-
Package the extension:
vsce package
This creates a .vsix file that can be installed in VS Code.
- extension.ts: Main entry point, registers commands and providers
- loginPanelProvider.ts: Manages webview lifecycle and communication
- App.tsx: Main application component
- LoginForm.tsx: Login form with validation and state management
- useVSCode.ts: Custom hook for VS Code API integration
- User interacts with React components
- Components use
useVSCodehook to send messages - Extension receives messages via
onDidReceiveMessage - Extension can send responses back to webview
- React components update based on responses
- Separation of Concerns: Clear separation between extension and webview
- Type Safety: Full TypeScript coverage
- Error Handling: Proper error boundaries and validation
- Performance: Optimized builds and lazy loading
- Accessibility: ARIA labels and keyboard navigation
- Theme Integration: Seamless VS Code theme adaptation
- Development Experience: Hot reload and debugging support
- This is a design-only implementation with no actual authentication functionality
- The login form is fully functional from a UI perspective
- All form validation and error handling is implemented
- Social login buttons are present but non-functional
- The extension follows VS Code extension best practices and patterns