AD SPACE AVAILABLE · BRAND PARTNERS WELCOME

Configuring Code GPT in JetBrains IDEs: Multi-File Context Indexing and Air-Gapped Ollama Execution

傅星達 · 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

Enterprise backend and full-stack engineers operating within strict compliance perimeters—such as financial technology, healthcare systems, and critical infrastructure—face a persistent dilemma. While artificial intelligence code assistants accelerate daily development, enterprise security policies strictly prohibit dispatching proprietary source code over public networks to third-party software-as-a-service (SaaS) APIs.

Furthermore, existing tutorials disproportionately target Visual Studio Code, leaving JetBrains power users (working in IntelliJ IDEA, PyCharm, WebStorm, or GoLand) to navigate fragmented documentation, socket port conflicts, and ambiguous indexing behaviors.

This technical guide delivers an end-to-end setup for integrating the Code GPT plugin in JetBrains IDEs with a local Ollama runtime. It details how to achieve full multi-file semantic codebase indexing and invoke context-aware quick actions—such as refactoring, test generation, and code explanation—in a zero-egress, fully offline environment.


365Finds Institutional Verdict & Recommendations

At 365Finds, our research leads to three firm operational judgments regarding local AI copilots in enterprise IDEs:

  1. Local Copilots Require Deliberate Model Selection, Not Compromise: For local offline software engineering, 365Finds recommends selecting parameter-specialized coding models rather than general chat models. We specifically favor qwen2.5-coder:7b for developer laptops (16 GB to 32 GB RAM) and qwen2.5-coder:14b or deepseek-coder:base for high-end workstations. Sub-7B models lack the architectural understanding required for cross-module refactoring and reliable unit test mocking, whereas unquantized 32B+ models introduce unacceptable typing and streaming latency in JetBrains tool windows.
  2. Multi-File Indexing Is Non-Negotiable for Complex Enterprise Projects: Highlighting isolated code snippets only serves trivial syntax queries. In multi-layered enterprise repositories (such as domain-driven Spring Boot or Django apps), engineers need semantic context spanning interfaces, entity mappings, and utility layers. Code GPT's codebase vectorization provides this architectural awareness entirely in local memory, keeping proprietary repositories air-gapped.
  3. Adopt a Defensive Workflow with Profile Modes: Running local models locally introduces occasional hallucinations in edge-case code generations. 365Finds explicitly advises developers to use Search Mode for read-only repository exploration and architecture discovery, while reserving Agent Mode for file-modifying tasks coupled with strict Git version control and diff inspection. Never allow automated file changes without explicit line-by-line diff review.

Technical Prerequisites and Architecture Overview

Before commencing configuration, verify that your development workstation meets these baseline requirements:

ComponentMinimum RequirementRecommended SpecificationEnterprise Rationale
JetBrains IDE2023.2 or newer (IntelliJ, PyCharm, WebStorm, GoLand)Latest Stable (2024.x or 2025.x)Modern plugin runtime APIs; optimized background task scheduling
Local Hardware16 GB RAM; 4-core modern CPU32 GB unified memory (Apple Silicon) or NVIDIA GPU (8 GB+ VRAM)Sustains concurrent IDE indexing and local LLM tensor operations
Local RuntimeOllama CLI (Linux, macOS, Windows)Latest Ollama release with GPU acceleration enabledManages local model quantization and OpenAI-compatible API serving
Local Ports11434 (Ollama), 54112 / 54113 (Code GPT bridge)Ensure ports are open on localhost (127.0.0.1)Avoid socket collisions with local corporate proxies or microservices
┌────────────────────────────────────────────────────────┐
│                   JetBrains IDE                        │
│  (IntelliJ IDEA / PyCharm / WebStorm / GoLand)         │
│                                                        │
│  ┌──────────────────────────────────────────────────┐  │
│  │               Code GPT Plugin                    │  │
│  │                                                  │  │
│  │  ┌────────────────────┐   ┌───────────────────┐  │  │
│  │  │ Context Indexer    │   │ Quick Action Menu │  │  │
│  │  │ (Local Vector DB)  │   │ Refactor / Tests  │  │  │
│  │  └─────────┬──────────┘   └─────────┬─────────┘  │  │
│  └────────────┼────────────────────────┼────────────┘  │
│               │                        │               │
│      Port: 54112 / 54113               │               │
└───────────────┼────────────────────────┼───────────────┘
                │                        │
                │ HTTP API Requests      │
                │ (http://localhost:11434)
                ▼                        ▼
┌────────────────────────────────────────────────────────┐
│                   Ollama Runtime                       │
│  ┌──────────────────────────────────────────────────┐  │
│  │ Local Model Tensor Execution (Air-Gapped)        │  │
│  │ - qwen2.5-coder:7b                               │  │
│  │ - deepseek-coder / codestral                     │  │
│  └──────────────────────────────────────────────────┘  │
└────────────────────────────────────────────────────────┘

Step 1: Install and Initialize Ollama for Offline Coding

Ollama serves as the local inference engine that runs quantized weights on local compute units without sending tokens outside the machine perimeter.

1. Download and Verify Ollama Installation

Download and install the appropriate runtime package for your operating system from ollama.ai (or ollama.com). Verify that the binary is available in your shell environment:

ollama --version

2. Pull Recommended Enterprise Coding Models

In your terminal, execute the pull command for your target model. Pulling downloads model weights without locking terminal input into an interactive chat session:

# Recommended baseline for 16GB RAM workstations
ollama pull qwen2.5-coder:7b

# Alternative for specialized test and syntax operations
ollama pull deepseek-coder:base

# High-performance alternative for dedicated workstations (32GB+ RAM)
ollama pull codestral:latest

Wait until the progress bar reaches 100% and confirms checksum verification.

3. Verify Local API Connectivity and Endpoint Binding

Ollama binds by default to http://localhost:11434. Verify that the REST API responds correctly:

curl http://localhost:11434/api/tags

The response returns a JSON payload listing available local models.

Troubleshooting Note: If the service fails to connect or returns connection refused errors, check whether an existing system environment variable named OLLAMA_HOST is overriding the localhost binding. Remove or reset any invalid OLLAMA_HOST variable and restart the daemon to restore default localhost routing.


Step 2: Install Code GPT in Your JetBrains Environment

Code GPT provides the IDE integration layer, handling context injection, tool windows, editor context menus, and AST-level inspections.

1. Installation via JetBrains Marketplace

  1. Launch IntelliJ IDEA, PyCharm, WebStorm, or your respective JetBrains IDE.
  2. Open Settings:
    • macOS: IntelliJ IDEA (or IDE name) > Settings / Preferences (Shortcut: Cmd + ,).
    • Windows / Linux: File > Settings (Shortcut: Ctrl + Alt + S).
  3. Select Plugins from the left navigation tree.
  4. Select the Marketplace tab at the top.
  5. In the search box, enter Code GPT.
  6. Locate the plugin and click Install.
  7. When prompted, restart your IDE to ensure that service listeners and background daemons initialize cleanly.

2. Alternative Manual Installation from Disk

In strictly offline, air-gapped development machines without marketplace access:

  1. Download the plugin package archive (.zip or .jar) on an authorized external transfer workstation.
  2. Transfer the archive to the secure workstation.
  3. In the Plugins pane, click the gear icon (⚙️) in the upper-right corner.
  4. Select Install Plugin from Disk..., browse to your file, click OK, and restart the IDE.

3. Socket Port Verification

Code GPT utilizes local internal communication ports (such as 54112 or 54113) for its UI-to-daemon bridge. Ensure no local dev servers, Docker containers, or internal firewalls reserve these ports.


Step 3: Connect Code GPT to the Local Ollama Provider

Once installed, configure the plugin to point to your offline Ollama endpoint rather than public cloud APIs.

  1. Open the Code GPT Tool Window: Click the Code GPT icon in the right-hand or left-hand tool window dock.
  2. Open Model Management: Click the gear icon (⚙️) or select Manage Models in the chat panel header.
  3. Select Provider Category: In the model configuration panel, select the Local LLMs (or Local) tab.
  4. Choose Ollama: Select Ollama from the list of available local providers.
  5. Configure Server Address: Enter the server URL where Ollama is listening:
    http://localhost:11434
    
    (If your enterprise hosts an on-premise dedicated inference server on an isolated subnet, enter that server's internal IP address, e.g., http://10.20.30.40:11434).
  6. Select Your Downloaded Model: Select your pulled model (e.g., qwen2.5-coder:7b or deepseek-coder:base) from the model dropdown menu.
  7. Save & Test Connectivity: Click outside the settings panel and enter a quick diagnostic query in the chat window, such as "Ping: Confirm local execution." The response will stream directly from your local hardware with zero external network traffic.

Step 4: Configure Multi-File Context Indexing (Local Codebase Index)

The primary failure mode of local AI assistants in enterprise environments is context starvation. A single open file rarely contains the domain models, dependency injection containers, or helper functions required for accurate code synthesis.

Code GPT resolves this through Codebase Indexing, creating an embedded semantic vector database directly on your local workstation.

Enterprise Project Root
├── .codegptignore            <-- Excludes build directories, logs, credentials
├── src/main/java
│   ├── controller/           <-- Parsed and Vectorized
│   ├── service/              <-- Parsed and Vectorized
│   └── model/                <-- Parsed and Vectorized
└── target/ / build/          <-- Bypassed during local indexing

1. Initializing Codebase Indexing

  1. In the Code GPT tool panel, locate and click the Codebase (or Augmented Context) button.
  2. Click Create Codebase Index.
  3. Select your project root directory or the specific microservice module you are actively developing.
  4. Allow the local indexing process to complete. The indexer parses file trees, tokenizes text, and stores semantic embeddings in a local vector store.

2. Configuring Exclusion Boundaries (.codegptignore)

To avoid consuming local RAM with build artifacts, minified scripts, and lockfiles, place a .codegptignore file at the root of your project:

# Build outputs and dependency stores
target/
build/
dist/
node_modules/
.gradle/

# Internal documentation and binary artifacts
*.class
*.jar
*.bin
*.pdf

# Environment secrets and local configurations
.env
.env.*
*.pem
*.key

3. Referencing Multi-File Context in Prompts

Once indexed, you can inject codebase-wide intelligence into queries:


Step 5: Utilizing Profile Modes for Safe Development

Code GPT introduces three distinct Profile Modes that govern how the assistant interacts with your project files:

Profile ModePrimary CapabilityOperation TypeRecommended Enterprise Use Case
💬 Chat ModeIsolated conversation; copy-pasted snippetsZero Project AccessAnswering general algorithmic questions; explaining standard library APIs
🔍 Search ModeDeep codebase semantic traversalRead-OnlyArchitecture discovery; tracking cross-file call hierarchies and contracts
🤖 Agent ModeMulti-file edits; iterative refactoring; commandsRead & WriteImplementing features across controller, service, and test suites

Operational Strategy for Engineers

  1. Start in Search Mode when diagnosing cross-module behavior (e.g., "Where are authentication tokens validated in our filter chain?"). This prevents inadvertent file modifications while exploring complex legacy architectures.
  2. Switch to Agent Mode only when you have defined a precise scope of modification.
  3. Keep the IDE's built-in Git staging window open. Because local models may occasionally introduce minor formatting inconsistencies, evaluate every suggested modification in JetBrains's side-by-side diff view before committing.

Step 6: Leveraging In-Editor Quick Actions

Rather than manually copying and pasting code blocks into chat windows, JetBrains developers can invoke Code GPT's specialized routines directly from the editor's contextual menu.

1. Code Explanation (Explain CodeGPT)

When inspecting unfamiliar legacy logic:

  1. Highlight the class, method, or complex algorithmic loop.
  2. Right-click and navigate to Code GPT > Explain CodeGPT (or type /Explain in the interactive chat prompt).
  3. The local model breaks down parameter assumptions, edge cases, and asynchronous lifecycle flows, drawing from indexed project models.

2. Intelligent Refactoring (Refactor CodeGPT)

To improve maintainability, reduce cyclomatic complexity, or modernize syntax:

  1. Highlight the target code block.
  2. Right-click and select Code GPT > Refactor CodeGPT (or execute /Refactor).
  3. Enter your specific requirement, such as:

    "Extract the nested database transaction into a separate private method with explicit rollback annotations."

  4. Review the generated refactoring and use the diff stream to merge clean edits into your active buffer.

3. Unit Test Generation (Unit Test CodeGPT)

Writing comprehensive unit tests is often the most time-consuming task in enterprise sprints. Code GPT generates test suites tailored to your local test framework:

  1. Highlight the target service method.
  2. Right-click and select Code GPT > Unit Test (or type /Unit Test).
  3. The local model analyzes the method signature and referenced domain objects via the codebase index, producing test fixtures that match your project's existing testing idioms (such as JUnit 5 with Mockito in Java, or pytest with pytest-mock in Python).
// Example: Highlighting a payment execution method and invoking /Unit Test
// Generated test fixture automatically mocks indexed dependencies:
@ExtendWith(MockitoExtension.class)
class PaymentExecutionServiceTest {

    @Mock
    private PaymentGatewayClient paymentGatewayClient;

    @Mock
    private TransactionAuditRepository auditRepository;

    @InjectMocks
    private PaymentExecutionService executionService;

    @Test
    void executePayment_ValidRequest_RecordsAuditAndCompletes() {
        // Automatically populated with realistic domain DTOs from @codebase
        PaymentCommand command = new PaymentCommand("TX-1002", new BigDecimal("150.00"), "USD");
        when(paymentGatewayClient.authorize(command)).thenReturn(PaymentResponse.success());

        PaymentResult result = executionService.process(command);

        assertThat(result.isSuccess()).isTrue();
        verify(auditRepository).saveAuditRecord(any(AuditRecord.class));
    }
}

Step 7: Enterprise Compliance and Security Hardening

To satisfy strict internal security auditing (e.g., SOC 2 Type II, ISO 27001, or banking regulatory compliance), confirm the following checklist:

By following this architecture, software developers and enterprise architects operating in JetBrains environments can unlock the full productivity advantages of modern AI-assisted engineering while preserving total data sovereignty.


References