Skip to content

Visual Studio Code

MyDeskBot for VS Code brings powerful AI assistance to your VS Code editor.

Installation

From VS Code Marketplace

  1. Open VS Code
  2. Go to Extensions view (Ctrl+Shift+X / Cmd+Shift+X)
  3. Search for "MyDeskBot"
  4. Click Install

From Command Line

bash
code --install-extension mydeskbot.mydeskbot-vscode

Configuration

Basic Setup

Open settings (Ctrl+, / Cmd+,) and configure:

json
{
  "mydeskbot.apiKey": "sk-...",
  "mydeskbot.model": "gpt-4o",
  "mydeskbot.temperature": 1.0,
  "mydeskbot.maxTokens": 4096
}

Environment Variables

Alternatively, use environment variables:

bash
# In your shell profile (.bashrc, .zshrc, etc.)
export OPENAI_API_KEY="sk-..."
export ANTHROPIC_API_KEY="sk-ant-..."

Workspace Settings

Configure per-project in .vscode/settings.json:

json
{
  "mydeskbot.model": "gpt-4o",
  "mydeskbot.temperature": 0.7,
  "mydeskbot.contextFiles": 5
}

Features

1. Inline Completions

Get code suggestions as you type:

javascript
// Start typing
function calculateA

// MyDeskBot suggests
function calculateAverage(numbers) {
  return numbers.reduce((sum, num) => sum + num, 0) / numbers.length;
}

Settings:

  • mydeskbot.inlineCompletions.enabled: Enable/disable inline completions
  • mydeskbot.inlineCompletions.triggerMode: Manual or Automatic

2. Inline Chat

Ask questions without leaving the editor:

  1. Press Ctrl+Shift+M (or Cmd+Shift+M)
  2. Type your question
  3. Get inline responses

Example:

javascript
// MyDeskBot: How do I handle errors in async functions?
try {
  const data = await fetchData();
  return data;
} catch (error) {
  console.error("Error:", error);
  throw error; // Re-throw for caller to handle
}

3. Code Actions

Right-click on selected code for AI actions:

  • Explain Code: Get detailed explanation
  • Refactor: Improve code quality
  • Add Comments: Generate documentation
  • Find Bugs: Identify issues
  • Generate Tests: Create unit tests
  • Optimize: Improve performance

4. Side Panel Chat

Open the dedicated chat panel:

  1. Click the MyDeskBot icon in the sidebar
  2. Or press Ctrl+Shift+P → "MyDeskBot: Open Chat"
  3. Ask questions in the chat interface

5. Multi-File Context

MyDeskBot understands your entire workspace:

  • Current file
  • Open files
  • Project structure
  • Dependencies
  • Configuration files

Keyboard Shortcuts

ActionWindows/LinuxmacOS
Open Chat PanelCtrl+Shift+P → "Open Chat"Cmd+Shift+P → "Open Chat"
Inline ChatCtrl+Shift+MCmd+Shift+M
Explain CodeCtrl+Shift+ECmd+Shift+E
RefactorCtrl+Shift+RCmd+Shift+R
Generate TestsCtrl+Shift+TCmd+Shift+T
Complete CodeTabTab
Trigger SuggestionCtrl+SpaceCtrl+Space
Quick FixCtrl+.Cmd+.

Commands

All commands available via Command Palette (Ctrl+Shift+P / Cmd+Shift+P):

  • MyDeskBot: Open Chat: Open the side panel chat
  • MyDeskBot: Explain Code: Explain selected code
  • MyDeskBot: Refactor Code: Refactor selected code
  • MyDeskBot: Add Comments: Generate comments for selection
  • MyDeskBot: Generate Tests: Generate tests for selection
  • MyDeskBot: Find Bugs: Find bugs in selection
  • MyDeskBot: Optimize Code: Optimize selected code
  • MyDeskBot: Toggle Inline Completions: Enable/disable inline completions

Workflows

1. Code Review

  1. Select code to review
  2. Press Ctrl+Shift+E (Explain Code)
  3. MyDeskBot provides:
    • Code quality assessment
    • Potential bugs
    • Security issues
    • Performance suggestions

2. Refactoring

  1. Select code to refactor
  2. Press Ctrl+Shift+R (Refactor)
  3. Choose refactoring type:
    • Simplify logic
    • Improve readability
    • Extract functions
    • Optimize performance

3. Documentation

  1. Select function or class
  2. Right-click → "Add Comments"
  3. MyDeskBot generates:
    • JSDoc/TSDoc comments
    • Parameter descriptions
    • Return value docs
    • Usage examples

4. Test Generation

  1. Select a function or class
  2. Press Ctrl+Shift+T (Generate Tests)
  3. MyDeskBot creates:
    • Test file structure
    • Test cases
    • Mocks and stubs
    • Assertions

5. Debugging

  1. Select problematic code
  2. Right-click → "Find Bugs"
  3. MyDeskBot analyzes:
    • Potential causes
    • Edge cases
    • Suggested fixes

Settings Reference

Model Configuration

json
{
  "mydeskbot.apiKey": "sk-...",
  "mydeskbot.model": "gpt-4o",
  "mydeskbot.temperature": 1.0,
  "mydeskbot.maxTokens": 4096,
  "mydeskbot.streamResponses": true
}

Completion Settings

json
{
  "mydeskbot.inlineCompletions.enabled": true,
  "mydeskbot.inlineCompletions.triggerMode": "automatic",
  "mydeskbot.suggestAfterTypeDelay": 200
}

Context Settings

json
{
  "mydeskbot.contextFiles": 5,
  "mydeskbot.includeReadme": true,
  "mydeskbot.includePackageJson": true,
  "mydeskbot.includeGitignore": true
}

UI Settings

json
{
  "mydeskbot.showInlineIndicator": true,
  "mydeskbot.chatFontSize": 14,
  "mydeskbot.lineHeight": 1.5,
  "mydeskbot.theme": "dark"
}

Integration with VS Code Features

Git Integration

Commit Messages:

bash
# Open Command Palette → "MyDeskBot: Generate Commit Message"
# MyDeskBot analyzes changes and generates a descriptive message

Pull Request Reviews:

  • Ask MyDeskBot to review PR changes
  • Get suggestions for improvements
  • Generate review comments

Debugging

Error Analysis:

  1. When debugging, copy error message
  2. Ask MyDeskBot in chat
  3. Get explanations and solutions

Breakpoint Suggestions:

  • MyDeskBot suggests where to set breakpoints
  • Helps identify suspicious code areas

Testing

Test Runner Integration:

  • Generate tests for selected code
  • Run tests and ask MyDeskBot to analyze failures
  • Fix failing tests with AI assistance

Snippets

MyDeskBot can help you create custom snippets:

javascript
// Ask: "Create a React component snippet for a user profile"
// MyDeskBot generates:
{
  "User Profile": {
    "prefix": "user-profile",
    "body": [
      "import React from 'react';",
      "",
      "const UserProfile = ({ user }) => {",
      "  return (",
      "    <div className=\"user-profile\">",
      "      <img src={user.avatar} alt={user.name} />",
      "      <h2>{user.name}</h2>",
      "      <p>{user.email}</p>",
      "    </div>",
      "  );",
      "};",
      "",
      "export default UserProfile;"
    ],
    "description": "React user profile component"
  }
}

Workspaces and Profiles

Multiple Workspaces

Different settings for different workspaces:

json
// workspace-1/.vscode/settings.json
{
  "mydeskbot.model": "gpt-4o",
  "mydeskbot.temperature": 0.7
}

// workspace-2/.vscode/settings.json
{
  "mydeskbot.model": "gpt-3.5-turbo",
  "mydeskbot.temperature": 1.0
}

Team Profiles

Share settings with your team:

json
// .vscode/settings.json
{
  "mydeskbot.apiKey": "${env:OPENAI_API_KEY}",
  "mydeskbot.model": "gpt-4o",
  "mydeskbot.teamShared": true
}

Troubleshooting

Extension Not Loading

  1. Check VS Code version (requires 1.75+)
  2. Reload VS Code (Ctrl+Shift+P → "Reload Window")
  3. Check extension logs:
    • Open Command Palette
    • "Developer: Show Extension Logs"
    • Look for MyDeskBot errors

API Key Issues

  1. Verify API key is correct
  2. Check account has credits
  3. Try different API provider
  4. Check network connectivity

No Suggestions

  1. Check if inline completions are enabled
  2. Verify model is configured
  3. Try manual trigger (Ctrl+Space)
  4. Check file is not too large

Slow Performance

  1. Reduce context file count
  2. Disable streaming
  3. Increase timeout
  4. Close unused files

Tips and Tricks

1. Context Awareness

Add file references in comments:

javascript
// See also: utils/validation.js
function validateEmail(email) {
  // MyDeskBot can reference the validation file
}

2. Iterative Refinement

Refine responses with follow-up:

javascript
// User: Generate a REST API for users
// [AI generates basic API]

// User: Add authentication
// [AI adds auth middleware]

// User: Add rate limiting
// [AI adds rate limiting]

3. Code Templates

Create reusable code templates with MyDeskBot:

Create a TypeScript React component with:
- Props interface
- useState hooks
- useEffect for data fetching
- Loading state
- Error handling

4. Learning Mode

Ask MyDeskBot to explain concepts:

javascript
// Ask: "Explain how React hooks work"
// Get detailed explanation with examples

Enterprise Features

For teams and organizations:

Shared Configuration

json
{
  "mydeskbot.teamSettings": {
    "model": "gpt-4o",
    "temperature": 0.7,
    "maxTokens": 4096
  }
}

Usage Analytics

Track AI usage across your team.

Custom Endpoints

json
{
  "mydeskbot.apiEndpoint": "https://api.yourcompany.com/v1"
}

Privacy & Security

  • Code Privacy: Code is sent only for processing
  • No Storage: We don't store your code
  • Encrypted: All transmissions use HTTPS
  • Local Option: Use local models for complete privacy

See Also