AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

How to Configure Sourcegraph Cody in JetBrains IDEs: Enterprise Setup and Preventing Completion Conflicts

Lam Mui Teng · 365Finds Editorial
Indexed 88,650 Wiki articles

Put 365 Wiki to work with your AI

Copy the prompt below, paste it into the AI you already use, then ask your question.

Download full Skill

Try it with the prompt first. If you use 365 Wiki often, install the full 365Wiki Skill so you do not have to paste it again. No regular AI? Gemini or Microsoft Copilot on the web will work.

365Wiki Skill

Connecting an AI assistant to an enterprise codebase shouldn't feel like negotiating a hostage crisis between your IDE and your corporate proxy. Yet when engineering teams deploy Sourcegraph Cody across JetBrains environments—whether IntelliJ IDEA, PyCharm, WebStorm, or GoLand—they routinely hit two immediate walls: keystroke race conditions that garble code completion, and authentication hurdles when linking self-hosted Sourcegraph instances.

At 365Finds, our testing across enterprise multi-repo architectures revealed a clear reality: Sourcegraph Cody delivers exceptional deep-context intelligence across distributed services, but its default configuration in JetBrains IDEs leads straight into an ergonomic mess unless you deliberately adjust your completion settings. Two AI engines fighting for the Tab key will ruin your workflow in ten minutes.

Here is the exact technical configuration required to connect private enterprise instances, configure remote repository contexts, and eliminate completion conflicts in JetBrains IDEs.


1. The Core Conflict: Why JetBrains and Sourcegraph Cody Clash

Starting with JetBrains 2024.1, JetBrains IDEs ship with native Full Line code completion enabled by default. This feature runs a local deep-learning model on your CPU or GPU to generate single-line gray ghost text, accepted by pressing Tab.

At the same time, Sourcegraph Cody runs its own cloud-backed multi-line autocomplete engine, which also proposes ghost text and binds to Tab.

Keystroke Event: [Tab]
       │
       ├─► JetBrains Full Line Engine (Local Model) ──► Insert 1 line
       └─► Sourcegraph Cody (Remote LLM)            ──► Insert multi-line block
       
Result: Partial insertions, cursor misplacement, and duplicated closing brackets.

When both systems run simultaneously without configuration, you encounter severe friction:

At 365Finds, we take a definitive stance: Do not let two inline AI engines compete for Tab. If your organization pays for Sourcegraph Cody to leverage enterprise code graph awareness, give Cody exclusive domain over inline ghost text, while retaining JetBrains' native popup completion for strict symbol lookups.


2. Step-by-Step: Connecting JetBrains to an Enterprise Sourcegraph Instance

Before fixing completion collisions, you must properly bind your IDE to your company's self-hosted or managed Sourcegraph Enterprise instance.

Step 2.1: Generate an Enterprise Access Token

  1. Open your browser and navigate to your internal Sourcegraph instance (for example, https://sourcegraph.corp.internal).
  2. Log in through your corporate SSO (Okta, GitHub Enterprise, GitLab, or SAML).
  3. Click your profile avatar in the upper right corner and select Settings.
  4. In the left navigation, select Access tokens (under User Settings).
  5. Click Generate new token. Enter an identifiable description (e.g., IntelliJ-Cody-Token) and set an expiration date in accordance with your internal security policies.
  6. Click Generate and immediately copy the token value (sgp_...).

Step 2.2: Install the Plugin and Authenticate

  1. In your JetBrains IDE, open settings via Ctrl+Alt+S (Windows/Linux) or Cmd+, (macOS).
  2. Go to Plugins, select the Marketplace tab, search for Cody: AI Coding Assistant with Autocomplete & Chat, and click Install. Restart the IDE if prompted.
  3. In settings, navigate to Tools | Sourcegraph (or Tools | Cody depending on the plugin build).
  4. In the authorization configuration:
    • Change the instance endpoint from the default https://sourcegraph.com to your organization's private instance URL (e.g., https://sourcegraph.corp.internal).
    • Paste the Access Token copied in Step 2.1.
  5. Click Apply and then OK. The Cody status bar icon should switch from disconnected to active.
Setting FieldDefault Cloud ValueEnterprise Target Value
Instance URLhttps://sourcegraph.comhttps://sourcegraph.corp.internal
Auth MethodWeb Browser OAuthPersonal Access Token (sgp_...)
Codebase ScopeCurrent Repo OnlyMulti-repo Enterprise Index

3. Resolving Completion Conflicts: Three Configuration Strategies

To eliminate autocomplete collisions, choose one of the following three architectural setups based on your team's workflow requirements.

Completion Architecture Trade-offs:

Approach A (365Finds Recommended)
┌────────────────────────────────────────────────────────┐
│ Inline Ghost Text: Sourcegraph Cody (Multi-line LLM)   │
│ Structural Symbols: JetBrains Native Popup (Ctrl+Space)│
│ Local Full Line: DISABLED                              │
└────────────────────────────────────────────────────────┘

Approach B (Dual-Engine Separation)
┌────────────────────────────────────────────────────────┐
│ Inline Ghost Text: JetBrains Local Full Line (Tab)     │
│ Advanced Synthesis: Sourcegraph Cody (Rebound to Alt+\)│
└────────────────────────────────────────────────────────┘

Approach A: The 365Finds Recommended Setup (Cody Exclusive Inline)

This configuration disables JetBrains' local neural completions to provide a unified, predictable experience driven by Cody's enterprise-aware models.

  1. Open Settings / Preferences (Ctrl+Alt+S or Cmd+,).
  2. Navigate to Editor | General | Code Completion.
  3. Under the Machine Learning-Assisted Completion section:
    • Uncheck Enable Full line suggestions.
    • Alternatively, under Plugins | Installed, uncheck and disable the bundled Full Line Code Completion plugin.
  4. If your IDE has JetBrains AI Assistant installed, either disable the plugin or disable its inline completion toggle to prevent a three-way collision.
  5. Under Editor | General | Code Completion, look for Inline Completion:
    • Ensure Insert with Tab is reserved for your primary inline provider.
  6. Result: Cody owns inline gray text and multiline code generation on Tab. JetBrains retains traditional code intelligence (imports, type checking, method signatures) on Ctrl+Space and Enter.

Approach B: Coexistence via Keymap Rebinding

If your organization mandates local-only completions for basic typing but permits Cody for complex blocks, rebind the acceptance trigger:

  1. Open Settings / Preferences | Keymap.
  2. Search for Cody: Accept Autocomplete or Accept Inline Proposal.
  3. Right-click the action, select Add Keyboard Shortcut, and assign an alternative keystroke—such as Right Arrow (→), Alt+Enter, or Ctrl+Alt+Y.
  4. Remove the Tab binding from Cody.
  5. In this mode, pressing Tab accepts JetBrains' native local completion, while pressing your custom shortcut accepts Cody's multi-line code block.

Approach C: Chat-Only Mode (Autocomplete Disabled)

For developers working in air-gapped repositories with strict latency constraints or zero cloud-completion tolerance:

  1. Click the Cody status icon in the JetBrains bottom status bar.
  2. Uncheck Enable Autocomplete.
  3. Cody remains fully functional for codebase-wide chat, inline refactoring (Ctrl+Shift+G or Cody context actions), unit test generation, and symbol lookups, while leaving JetBrains' native code completion untouched.

4. Connecting and Querying Enterprise Codebases

Authenticating the plugin is only half the battle. Cody's primary commercial value lies in its ability to retrieve context across hundreds of remote microservices without requiring you to clone them locally.

Step 4.1: Repository Verification and Remote Matching

Cody automatically checks your workspace's local Git configuration:

git remote -v
# origin  git@github.corp.internal:platform/payment-service.git (fetch)

If this remote origin matches a repository already cloned and indexed by your Sourcegraph Enterprise instance, Cody automatically binds search embeddings and the code graph to your active IDE session.

Step 4.2: Querying Remote Repositories via @-Mentions

When debugging inter-service contracts, internal APIs, or shared schemas, you do not need the dependent repository open in your project window.

  1. Open the Cody chat panel via the sidebar or Alt+S.
  2. Type @ in the chat input.
  3. Select Repositories from the dropdown menu.
  4. Search for your remote enterprise repository (for example, @platform/auth-contracts or @shared/database-models).
  5. Enter your prompt:
    @shared/database-models How does the UserSession entity handle token expiration, and how should our payment service validate it?
    

Sourcegraph Cody executes remote search vectors on your enterprise server and streams contextual references directly into your JetBrains session.


5. Troubleshooting Common Enterprise Hurdles

In enterprise rollouts, standard setups frequently stumble over corporate network security. Here is how 365Finds resolves the two most common failures:

Issue 1: SSL Handshake and Self-Signed Certificate Errors

Issue 2: Remote Context Not Resolving


6. The 365Finds Assessment

Sourcegraph Cody provides genuine multi-repository enterprise search in a way that local IDE completion engines simply cannot replicate. Being able to pull precise code patterns from five un-cloned microservices inside an IntelliJ chat session saves real engineering hours every week.

However, the onboarding friction in JetBrains is unnecessarily steep. Out of the box, Cody does not detect the active presence of JetBrains Full Line completion, leaving developers to figure out why their Tab key is behaving erratically. Disabling JetBrains Full Line completion and binding Cody to an enterprise token transforms a chaotic keystroke war into a cohesive development environment.


References