AI Writing with Voice

VS Code Voice Programming Practical Guide: Voice Input Tips for Code Comments, Documentation, and Prompts

VS Code Voice Programming Practical Guide

As a developer, you write a lot of code comments, documentation, Git commit messages, and Pull Request descriptions every day. These "non-code" text inputs take up quite a bit of time. If you could complete these tasks quickly with voice, development efficiency would significantly improve.

This article will detail how to use voice input in VS Code, including multiple practical scenarios and specific techniques.

Why Developers Need Voice Input?

Text Input Scenarios in Development

In a typical development day, you might write:

  • Code comments: Explaining function purposes, parameter descriptions, usage examples
  • README documentation: Project introduction, installation guides, usage methods
  • API documentation: Interface descriptions, parameter descriptions, return value formats
  • Git commit messages: Describing the purpose and content of changes
  • Pull Request descriptions: Explaining the reason for changes, scope of impact, testing methods
  • Code review comments: Raising questions, giving suggestions
  • GitHub Copilot / Cursor prompts: Describing the code you need to AI

These text inputs might occupy 20-30% of your work time. With voice input, this time can be reduced to 1/3 of the original.

Core Value of Voice Input

  1. Speed: Speaking is 3-5 times faster than typing
  2. Continuous train of thought: Your train of thought isn't interrupted while speaking
  3. More detailed descriptions: Voice allows you to easily speak more details
  4. Reduced fatigue: Less strain on fingers and wrists from typing

Implementation Solutions for VS Code Voice Input

Solution Comparison

SolutionProsConsUse Case
VS Code voice extensionHigh integrationLimited functionality, requires internetSimple scenarios
System voice inputFree, simpleRequires internet, average accuracyOccasional use
Desktop voice input toolPowerful features, offline availableRequires additional installationFrequent use

Recommended Solution: Desktop Voice Input Tool

Using a desktop voice input tool (like Voconly), you can insert voice-to-text directly into VS Code's editor.

Advantages:

  • Doesn't depend on VS Code extensions
  • Can be used in any application (not just VS Code)
  • Supports offline operation
  • More powerful features

This article uses Voconly as an example to introduce how to use voice input in VS Code.

Detailed Steps: Setting Up Voice Input in VS Code

Step 1: Install Voconly

  1. Visit Voconly Website
  2. Download and install the version for your system

Step 2: Configure Model

Select a speech recognition model suitable for programming scenarios:

Recommended: Qwen-ASR-1.7B

  • Strong Chinese and English mixed recognition capability
  • Accurate technical terminology recognition
  • Suitable for code comments, technical documentation

Alternative: SenseVoice Medium

  • More accurate for pure Chinese scenarios
  • Lightweight model, runs smoothly on CPU too

Step 3: Set Shortcut Key

Choose a convenient shortcut:

Recommended: Ctrl + Shift + V (Windows) or Cmd + Shift + V (macOS)

  • Easy to remember
  • Doesn't conflict with common VS Code shortcuts

Step 4: Test in VS Code

  1. Open VS Code
  2. Open any code file
  3. Place cursor where you want to insert text
  4. Press Voconly shortcut key
  5. Speak to test
  6. Press shortcut key again to stop
  7. Check if text is correctly inserted

Practical Scenario 1: Code Comments

Function Comments

Scenario: Adding detailed docstring for a function

Voice Input Example:

Calculate the number of workdays between two dates.

Parameters:
start_date: Start date, in YYYY-MM-DD string format
end_date: End date, in YYYY-MM-DD string format
holidays: Optional, list of holiday dates

Returns:
Integer, representing the number of workdays (excluding weekends and holidays)

Example:
calculate_workdays("2026-01-01", "2026-01-31") returns 22

Note:
If start date is later than end date, returns 0

Generated Comment:

def calculate_workdays(start_date: str, end_date: str, holidays: list = None) -> int:
    """
    Calculate the number of workdays between two dates.
    
    Parameters:
        start_date: Start date, in YYYY-MM-DD string format
        end_date: End date, in YYYY-MM-DD string format
        holidays: Optional, list of holiday dates
    
    Returns:
        Integer, representing the number of workdays (excluding weekends and holidays)
    
    Example:
        calculate_workdays("2026-01-01", "2026-01-31") returns 22
    
    Note:
        If start date is later than end date, returns 0
    """
    # Function implementation...

Inline Comments

Scenario: Explaining complex code logic

Voice Input Example:

Here we use binary search instead of iteration because the data is sorted, reducing time complexity from O(n) to O(log n)

Module Documentation

Scenario: Adding header documentation for a file or module

Voice Input Example:

User Authentication Module

Provides user login, registration, and permission verification functions.
Dependencies: Database connection, JWT library, password encryption tool
Author: Development Team
Created: January 2026

Practical Scenario 2: Documentation Writing

README Documentation

Scenario: Writing README for a project

Voice Input Example:

FastDateUtil - High-Performance Date Processing Tool

Introduction:
FastDateUtil is a high-performance date processing library written in Rust, providing Python bindings.
10x faster than pure Python implementation, zero dependencies, supports offline use.

Installation:
pip install fast-date-util

Features:
- Workday calculation
- Holiday detection
- Date formatting
- Time interval calculation

Quick Start:
from fast_date_util import calculate_workdays
result = calculate_workdays("2026-01-01", "2026-01-31")
print(result)  # Output 22

Performance:
In 1 million calculations test, FastDateUtil is 12x faster than Python standard library.

License:
MIT

API Documentation

Scenario: Writing API interface documentation

Voice Input Example:

Get User List

Endpoint: GET /api/v1/users

Request Parameters:
page: Page number, default 1
page_size: Items per page, default 20, max 100
status: User status filter, options are active, inactive, all

Response Format:
{
  "data": [
    {
      "id": 1,
      "username": "user1",
      "email": "user1@example.com",
      "status": "active"
    }
  ],
  "total": 100,
  "page": 1,
  "page_size": 20
}

Error Codes:
400: Parameter error
401: Unauthorized
500: Server error

Practical Scenario 3: Git Commit Messages

Feature Development Commit

Voice Input Example:

Add user authentication functionality

New:
- User login endpoint, supports username and password login
- JWT token generation and verification
- Login status middleware

Modified:
- Updated route configuration, added authentication-related routes
- Database added users table

Tests:
- New login endpoint unit tests
- Test coverage 95%

Bug Fix Commit

Voice Input Example:

Fix workday calculation error

Issue:
When calculating workdays across years, there was a duplicate calculation of January 1st

Cause:
Incorrect boundary condition handling in date loop

Solution:
Fixed the loop termination condition to ensure no duplicate calculation

Impact:
Only affects calculate_workdays function

Tests:
Added cross-year test cases, verified the fix

Practical Scenario 4: Pull Request Descriptions

Voice Input Example:

Add user permission management functionality

Background:
The project needs to support multi-user collaboration, with different users having different operation permissions.

Changes:
1. New permission model: viewer, editor, admin
2. Database added permissions table
3. Implemented permission check middleware
4. API endpoints added permission verification

Testing:
- Unit tests: 15 new test cases
- Integration tests: Verified permission control correctness
- Manual testing: Verified all scenarios in development environment

Impact:
- 5 new files
- 12 modified files
- 1 database migration script

Documentation:
- Updated API documentation
- Added permission configuration guide

Future Work:
- Frontend add permission management interface
- Add permission logging

Deployment Notes:
Need to execute database migration script

Practical Scenario 5: GitHub Copilot Prompts

GitHub Copilot can generate code based on your comments. Voice input lets you quickly provide detailed comments.

Quick Function Generation

Voice Input Comment:

Asynchronously fetch user data, supports caching and retry

Parameters:
user_id: User ID
use_cache: Whether to use cache, default True
max_retries: Maximum retry attempts, default 3

Returns:
User data dictionary, returns None if user doesn't exist

Behavior:
1. If cache enabled and cache exists, return cached data directly
2. Otherwise fetch data from API
3. If request fails, automatically retry, max max_retries times
4. Update cache after successful fetch

Copilot will generate corresponding code based on the comment.

Complex Logic Description

Voice Input Comment:

Implement a rate limiter, supports sliding window algorithm

Requirements:
1. Use Redis to store counts
2. Window size configurable, default 60 seconds
3. Each user counts independently
4. Supports custom limit threshold
5. Returns remaining requests and reset time

Practical Scenario 6: Cursor AI Prompts

Cursor is an AI-native code editor, and voice input can make your interaction with AI more efficient.

Code Generation

Voice Input Prompt:

Create a React component named UserCard, displaying user avatar, username, and bio

Requirements:
- Use TypeScript
- Support props type definition
- Avatar displayed as circle
- Responsive layout, mobile-friendly
- Add hover effect
- Support click event

Code Refactoring

Voice Input Prompt:

Refactor this function to separate database queries from business logic

Current Issues:
- Function too long, over 100 lines
- Database queries and business logic mixed together, hard to test
- No error handling

Refactoring Goals:
1. Create separate data access layer
2. Create business logic layer
3. Add error handling and logging
4. Maintain original functionality

Tips to Improve Voice Programming Efficiency

Tip 1: Use Code Snippet Templates

Create templates for common comment types:

Function Comment Template:

[function_name]: [brief description]

Parameters:
[param_name]: [type] - [description]

Returns:
[type] - [description]

Example:
[code example]

Tip 2: Voice + Keyboard Combination

  • Voice: Responsible for large amounts of text input (comments, documentation, commit messages)
  • Keyboard: Responsible for precise modifications and formatting adjustments
  • Shortcuts: Quickly switch between voice and keyboard

Tip 3: Segmented Input

For long documents, segmented input is easier to manage:

  1. First use voice to input framework and headings
  2. Then fill in detailed content section by section
  3. Finally use keyboard to adjust formatting

Tip 4: Correct Pronunciation of Technical Terms

To improve recognition accuracy:

TermRecommended Pronunciation
APIA P I (separate letters)
async/awaitasync await
JSONJ S O N or Jason
SQLS Q L or sequel
URLU R L

FAQ

Q1: Will voice input affect my programming train of thought?

No. On the contrary, voice input makes your train of thought more continuous. You don't need to worry about typing speed while speaking, you can focus on what you want to express.

Q2: How to handle special symbols in code?

Two ways:

  1. Voice input text content, then use keyboard to add code and symbols
  2. Voice input entire content, including describing symbols (like "parenthesis")

Recommended first approach, more efficient.

Q3: What if I'm in a noisy office environment?

Suggestions:

  • Use USB headset with good noise cancellation
  • Or use microphone with noise cancellation feature
  • Voconly and similar tools can set microphone sensitivity

Q4: How to handle recognition errors?

  • First use voice to quickly input main content
  • Then use keyboard to quickly correct errors
  • Recognition accuracy is usually above 95%, correction time is minimal

Summary

Using voice input in VS Code can significantly improve your development efficiency, especially for scenarios requiring large amounts of text input like code comments, documentation writing, and Git commit messages.

Recommend using offline voice input tools (like Voconly), which is free and open source, supports offline operation, has accurate technical terminology recognition, and is very suitable for development scenarios.

After mastering voice programming, you can:

  • Say in 20 seconds what would take 3 minutes to type for code comments
  • Quickly write detailed README and API documentation
  • Easily describe complex Git commits and PR content
  • Efficiently interact with GitHub Copilot or Cursor


Related Articles:

Start Voice-Prompting Your AI

Voconly lets you quickly voice-type prompts for ChatGPT, Claude, and other AI tools, dramatically improving your AI-assisted workflow.

Save 30 minutes of typing every day

Local processing, offline ready, data safe

More Downloads

Windows · macOS dual platform