Skip to main content
The Inline Assistant brings AI capabilities directly into your code editor, allowing you to generate, transform, and refine code without leaving your current context.

Activating Inline Assist

  1. Select code (or place cursor for insertion)
  2. Press Cmd+Enter (macOS) or Ctrl+Enter (Linux/Windows)
  3. Type your natural language prompt
  4. Press Enter to generate

Use Cases

Code Generation

Generate new code from scratch:
  1. Place cursor where you want code inserted
  2. Cmd+Enter → “Create a function that validates email addresses”
  3. Review the generated code
  4. Accept with Tab or reject with Esc

Code Transformation

Transform existing code:
  1. Select the code to transform
  2. Cmd+Enter → “Convert this to async/await”
  3. Review the diff
  4. Accept or modify
Example transformations:
"Add error handling"
"Convert to TypeScript"
"Extract this into a separate function"
"Optimize for performance"
"Add JSDoc comments"

Multi-selection Editing

Apply changes to multiple locations:
  1. Create multiple selections (Cmd+D to select next occurrence)
  2. Cmd+Enter → “Add null checks”
  3. AI processes each selection independently
  4. Review all changes together

Refactoring

Complex code restructuring:
"Convert this class to use dependency injection"
"Split this large function into smaller helpers"
"Replace this with the Builder pattern"

Documentation

Generate documentation:
"Add comprehensive JSDoc for this API"
"Write a doc comment explaining the algorithm"
"Generate usage examples for this function"

Inline Assist UI

Prompt Editor

When you activate inline assist, a prompt editor appears:
  • Input field - Type your natural language instruction
  • Model selector - Choose which AI model to use
  • Settings icon - Access inline assistant settings
  • Context indicators - Shows what context is being sent

Generation Preview

As code is generated:
  • Streaming text - See code appear in real-time
  • Diff highlighting -
    • Green: Added lines
    • Red: Removed lines
    • Modified lines show both colors
  • Thinking indicator - Shows when model is reasoning (for thinking-enabled models)

Action Buttons

During generation:
  • Stop (Esc) - Cancel generation
After generation:
  • Accept (Tab) - Apply changes
  • Reject (Esc) - Discard changes
  • Retry (Cmd+R) - Generate a new alternative
  • Edit prompt (Cmd+E) - Modify your instruction

Alternative Suggestions

Generate multiple variations:

Configure Alternative Models

{
  "agent": {
    "inline_alternatives": [
      {
        "provider": "anthropic",
        "model": "claude-3-5-sonnet-20241022"
      },
      {
        "provider": "openai",
        "model": "gpt-4o"
      }
    ]
  }
}

Cycling Alternatives

  • Press Cmd+R (macOS) or Ctrl+R (Linux/Windows) to generate a new alternative
  • Use arrow buttons to cycle through generated alternatives
  • Each alternative is generated by a different model or with different parameters

Advanced Features

Context Integration

The Inline Assistant automatically includes:
  • Selected code and surrounding context
  • File type and language information
  • Imports and dependencies at the top of the file
  • LSP information (type definitions, symbol information)
  • Diagnostic errors in the selected region

Custom Instructions

Add context to your prompt:
Use the lodash library for this transformation

Write this following our coding standards:
- Use const/let, not var
- Add TypeScript types
- Include error handling

Code Actions Integration

Inline Assistant integrates with language server code actions:
  1. Place cursor on a diagnostic (error/warning)
  2. Cmd+. (macOS) or Ctrl+. (Linux/Windows)
  3. Select “Ask AI to fix this”
The AI will analyze the diagnostic and suggest a fix.

Configuration

Model Selection

Choose a specific model for inline assist:
{
  "agent": {
    "inline_assistant_model": {
      "provider": "openai",
      "model": "gpt-4o"
    }
  }
}
If not specified, falls back to default_model.

Streaming Tools

Enable streaming tool execution for iterative improvements:
{
  "agent": {
    "inline_assistant_use_streaming_tools": true
  }
}
With streaming tools:
  • The AI can make multiple edits in one generation
  • Faster iteration on complex transformations
  • Better handling of multi-file changes

Temperature Override

Control creativity for specific models:
{
  "agent": {
    "model_parameters": [
      {
        "provider": "anthropic",
        "model": "claude-3-5-sonnet-20241022",
        "temperature": 0.7
      }
    ]
  }
}
Lower temperature (0.0-0.5) = More deterministic Higher temperature (0.8-1.0) = More creative

Keyboard Shortcuts

ActionmacOSLinux/Windows
Start inline assistCmd+EnterCtrl+Enter
Accept changesTabTab
Reject changesEscEsc
Retry/Next alternativeCmd+RCtrl+R
Previous alternativeCmd+Shift+RCtrl+Shift+R
Edit promptCmd+ECtrl+E
Stop generationEscEsc
Open settingsCmd+,Ctrl+,

Best Practices

Be Specific

❌ Bad: “Fix this” ✅ Good: “Add null checks and handle the case where user.email is undefined”

Provide Context

❌ Bad: “Add validation” ✅ Good: “Add validation using the Joi library like we use in other API routes”

Use Natural Language

You don’t need to be overly technical:
  • “Make this code safer” ✓
  • “Add error handling for network failures” ✓
  • “Use the same pattern as the login function” ✓

Iterate

Don’t expect perfection on first try:
  1. Generate initial code
  2. Accept it
  3. Select what needs improvement
  4. Cmd+Enter → “Now add logging”

Review Before Accepting

Always review generated code:
  • Check for logic errors
  • Verify it matches your coding style
  • Ensure dependencies exist
  • Test the changes

Combine with Editor Features

  • Use multi-cursor for repeated patterns
  • Select code blocks (functions, classes) for targeted changes
  • Leverage language server errors to guide fixes

Examples

Example 1: Add Error Handling

Before:
async function fetchUser(id: string) {
  const response = await fetch(`/api/users/${id}`);
  return response.json();
}
Prompt: “Add comprehensive error handling” After:
async function fetchUser(id: string) {
  try {
    const response = await fetch(`/api/users/${id}`);
    
    if (!response.ok) {
      throw new Error(`Failed to fetch user: ${response.statusText}`);
    }
    
    return await response.json();
  } catch (error) {
    console.error('Error fetching user:', error);
    throw error;
  }
}

Example 2: Convert to TypeScript

Before:
function calculateTotal(items) {
  return items.reduce((sum, item) => sum + item.price * item.quantity, 0);
}
Prompt: “Add TypeScript types” After:
interface CartItem {
  price: number;
  quantity: number;
}

function calculateTotal(items: CartItem[]): number {
  return items.reduce((sum, item) => sum + item.price * item.quantity, 0);
}

Example 3: Generate Tests

Before:
fn parse_email(input: &str) -> Result<String, ParseError> {
    // implementation
}
Prompt: “Generate comprehensive unit tests” After:
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_parse_valid_email() {
        assert_eq!(
            parse_email("[email protected]").unwrap(),
            "[email protected]"
        );
    }

    #[test]
    fn test_parse_invalid_email() {
        assert!(parse_email("invalid").is_err());
    }

    #[test]
    fn test_parse_empty_string() {
        assert!(parse_email("").is_err());
    }
}

Troubleshooting

Generation is slow

  • Try a faster model (e.g., GPT-4o-mini instead of GPT-4o)
  • Reduce the selected context size
  • Check your internet connection
  • Consider using a local model via Ollama

Results are not relevant

  • Be more specific in your prompt
  • Include more surrounding code in your selection
  • Mention specific libraries or patterns to use
  • Try a different model

Changes are not being applied

  • Make sure you press Tab to accept
  • Check that the file is not read-only
  • Verify the file hasn’t been modified externally

Context is wrong

  • The assistant uses the code around your selection
  • Expand your selection to include more context
  • Mention specific files or symbols in your prompt