RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Fredoline Eruo
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /Local AI for Code Generation
  6. /Ch. 6
Local AI for Code Generation

06. Chat in Editor

Chapter 6 of 18 · 20 min
KEY INSIGHT

In-editor chat combines natural language interaction with full code context, letting you explain, generate, and refactor code without leaving your workflow. Continue's chat interface provides conversational AI assistance directly within VS Code or JetBrains. The chat panel appears on the right side and maintains conversation history throughout your session. Opening chat (`Ctrl+L` or `Cmd+L`) presents an empty input field. Type your question or request naturally: ``` Explain what this function does: def normalize_vector(v, target_magnitude=1.0): magnitude = sqrt(sum(x*x for x in v)) if magnitude == 0: return [0.0] * len(v) return [x * (target_magnitude / magnitude) for x in v] ``` The model receives the selected code automatically when you have text selected. Without selection, the model uses the current file's context. Chat capabilities include: - **Code explanation**: Ask "What does this do?" or "How does this algorithm work?" - **Code generation**: "Write a function that parses CSV with quoted fields" - **Refactoring**: "Convert this to use type hints" or "Extract this into a separate module" - **Debugging**: "Why is this returning None?" with error context - **Documentation**: "Add docstrings to all public methods in this class" Context attachment expands what the model can reason about. Click the paperclip icon or drag files into the chat panel to attach additional files: ``` Looking at auth.py and database.py together, suggest improvements to the authentication flow to reduce database queries while maintaining security. ``` The model receives the full content of attached files, enabling cross-file analysis. Multi-turn conversations work like standard chatΓÇöeach message appends to the history, and the model maintains context from earlier exchanges. This enables iterative refinement: ``` User: Write a function to validate email addresses Model: [generates email validation function] User: Make it reject disposable email domains Model: [modifies function to include disposable domain blocklist] User: Extract the domain validation into a separate function we can reuse Model: [refactors code into separate functions] ``` Context limits apply to conversations. Models with 32K+ context windows handle longer conversations better, but you'll eventually exhaust available tokens. When this happens, start a new conversation or use the `/clear` command to reset context. Streaming responses display incrementally as the model generates tokens. This feels responsive but can be jarring for longer outputs. Disable streaming in settings for more deliberate, complete responses: ```json { "models": [{ "title": "Deepseek Coder", "provider": "openai", "model": "deepseek-coder:33b", "api_base": "http://localhost:11434/v1", "streaming": false }] } ``` Inserting code from chat into the editor requires the `/insert` command or clicking the insertion button. The code appears at your cursor position. For multi-file changes, use the `/apply` command to apply patches to specific files.

EXERCISE

Open a file you wrote recently (not code you wrote today). Ask the chat to explain what a specific function does, then ask it to refactor that function according to specific criteria. Note how the model handles code it didn't generate versus code it created.

← Chapter 5
Autocomplete Setup
Chapter 7 →
Custom Commands