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

Overview

Inline assistance provides AI-powered help at your cursor position:
  • Transform selections - Refactor, explain, or modify selected code
  • Generate code - Create new code at cursor position
  • Context-aware - Uses surrounding code for better results
  • Fast responses - Optimized for quick interactions
The inline assistant uses streaming responses, so you see results as they’re generated.

Activation

Trigger the inline assistant:

Keyboard Shortcuts

ActionmacOSLinux/Windows
Open inline assistantcmd-ictrl-i
Accept suggestiontab or cmd-entertab or ctrl-enter
Reject suggestionescapeescape
Cancel generationescapeescape

Usage Modes

Transform Selection

Modify existing code:
1

Select Code

Highlight the code you want to transform
2

Open Assistant

Press cmd-i or ctrl-i
3

Describe Transformation

Type what you want to do:
  • “Refactor this to use async/await”
  • “Add error handling”
  • “Convert to TypeScript”
  • “Optimize this loop”
4

Review and Apply

Review the suggestion, then press tab to accept or escape to reject

Generate Code

Create new code at cursor:
1

Position Cursor

Place cursor where you want new code
2

Open Assistant

Press cmd-i or ctrl-i
3

Describe Intent

Type what you want to create:
  • “Write a function to validate email addresses”
  • “Create a React component for a user profile”
  • “Add JSDoc comments”
4

Accept Suggestion

Press tab to insert the generated code

Quick Actions

Predefined prompts for common tasks:

Explain

Get a detailed explanation of selected code

Refactor

Improve code structure and readability

Add Tests

Generate unit tests for selected code

Fix Bug

Identify and fix issues in selected code

Add Docs

Generate documentation comments

Optimize

Improve performance of selected code
Access via right-click context menu or command palette.

Inline Prompts

The inline assistant supports various prompt types:

Natural Language

convert this to use async/await syntax

add error handling with try/catch

refactor to remove duplication

optimize this for performance

Code Examples

rewrite this to look like:

const result = await fetch(url)
  .then(r => r.json())
  .catch(handleError);

Specific Instructions

- extract this logic into a separate function
- add TypeScript types
- handle edge cases for empty arrays
- use modern ES6+ syntax

Model Configuration

Configure which model handles inline requests:
{
  "agent": {
    "inline_assistant_model": {
      "provider": "anthropic",
      "model": "claude-4.6-sonnet"
    }
  }
}
Use CaseModelWhy
General useClaude 4.6 SonnetBest quality
Fast responsesGPT-4o MiniQuick, cost-effective
Complex refactoringClaude 4.6 SonnetBetter reasoning

Context Handling

Automatic Context

The inline assistant automatically includes:
  • Selected code - The highlighted text
  • Surrounding code - Lines above and below selection
  • File type - Language-specific context
  • Project structure - When relevant

Context Window

Control how much context is included:
{
  "agent": {
    "inline_context_lines": 50
  }
}
Larger context windows provide better results but use more tokens.

Diff Preview

Inline suggestions show as diffs:

Inline View

Changes appear directly in the editor:
  • Green: Added lines
  • Red: Removed lines
  • Yellow: Modified lines
Navigate with arrow keys.

Multi-step Editing

Chain multiple inline transformations:
1

First Transformation

Apply initial change (e.g., add error handling)
2

Refine

With code still selected, apply another transformation
3

Iterate

Continue refining until satisfied
4

Undo if Needed

cmd-z / ctrl-z to revert changes

Performance Tips

Keep selections focused - Select only the code you want to transform for faster results.
Use specific prompts - Clear, specific instructions get better results than vague requests.
Choose appropriate models - Use faster models for simple tasks, powerful models for complex ones.

Advanced Features

Custom Prompts

Create reusable prompts:
{
  "custom_inline_prompts": {
    "add_logging": "Add comprehensive logging to this function",
    "security_review": "Review this code for security vulnerabilities",
    "perf_optimize": "Optimize this code for performance without changing behavior"
  }
}
Access via command palette.

Code Templates

Generate boilerplate from templates:
@template:react-component CreateButton

@template:test-suite UserService
Define templates in settings or project-specific config.

Language-Specific Features

TypeScript/JavaScript

  • Add type annotations
  • Convert between JS and TS
  • Generate interfaces from objects
  • Async/await transformations

Python

  • Add type hints
  • Generate docstrings
  • Convert to/from dataclasses
  • Refactor to use list comprehensions

Rust

  • Add lifetime annotations
  • Convert to use Result<T, E>
  • Generate error handling
  • Derive trait implementations

Go

  • Add error handling
  • Generate method stubs
  • Convert to interfaces
  • Add context parameters

Troubleshooting

  • Switch to a faster model (e.g., GPT-4o Mini)
  • Reduce context window size
  • Select less code at once
  • Check network latency
  • Be more specific in your prompt
  • Include more context (select more code)
  • Try a different model
  • Provide example of desired output
  • Verify model is configured
  • Check API key authentication
  • Ensure feature is enabled in settings
  • Try restarting Glass

Keyboard Reference

ActionmacOSLinux/Windows
Open inline assistantcmd-ictrl-i
Accept suggestiontab or cmd-entertab or ctrl-enter
Reject suggestionescapeescape
Next suggestioncmd-]ctrl-]
Previous suggestioncmd-[ctrl-[
Show diffcmd-dctrl-d
Undocmd-zctrl-z

Next Steps

Build docs developers (and LLMs) love