How to Resolve GitHub Copilot Conflicts With Pylance in VS Code
🔍 WiseChecker

How to Resolve GitHub Copilot Conflicts With Pylance in VS Code

When you use GitHub Copilot alongside Pylance in VS Code for Python development, you might see duplicate suggestions, incorrect completions, or a slowdown in IntelliSense responsiveness. This happens because both extensions try to provide inline code completions and type-checking information, and their default settings can overlap. This article explains why these conflicts occur and provides clear steps to resolve them so Copilot and Pylance work together smoothly.

Key Takeaways: Fixing Copilot and Pylance Overlap

  • VS Code settings.json > editor.inlineSuggest.enabled: Controls whether inline suggestions appear; set to true for Copilot, but Pylance can override it.
  • VS Code settings.json > editor.suggest.showMethods: Set to false to reduce duplicate completion entries from Pylance when Copilot is active.
  • VS Code settings.json > python.analysis.inlayHints.variableTypes: Disabling this reduces visual clutter and prevents Pylance from interfering with Copilot suggestions.

ADVERTISEMENT

Why Copilot and Pylance Conflict in VS Code

GitHub Copilot and Pylance are both powerful extensions, but they can step on each other due to overlapping functionality. Copilot generates code suggestions based on context using a large language model, while Pylance provides fast type checking, IntelliSense, and inline hints using the Pyright language server.

The conflict arises in several areas:

Inline Suggestions Overlap

Both extensions can trigger inline suggestions. Copilot shows ghost text for code completions, and Pylance can also show inline hints for variable types, function return types, and parameter names. When both are active, the display can flicker, show duplicate text, or lag.

Completion List Duplication

When you type a variable or function name, the completion list may contain entries from both Copilot and Pylance. This can cause confusion and slow down the selection process. In some cases, Pylance entries override Copilot suggestions, making Copilot less useful.

Performance Impact

Running two extensions that both analyze code in real time can increase CPU and memory usage. On slower machines, this results in noticeable delays when typing or switching files.

Steps to Resolve Conflicts Between Copilot and Pylance

Follow these steps to configure VS Code so Copilot and Pylance work together without conflict. The changes are made in the settings.json file, which you can access from the Command Palette.

  1. Open VS Code settings.json
    Press Ctrl+Shift+P to open the Command Palette. Type Preferences: Open Settings (JSON) and select it. This opens the settings.json file where you can add or modify configuration keys.
  2. Disable Pylance inline suggestions for variable types
    Add this line inside the JSON object: "python.analysis.inlayHints.variableTypes": false. This stops Pylance from showing inline type hints next to variable names, which can overlap with Copilot ghost text. Save the file.
  3. Reduce duplicate completion entries from Pylance
    Add this line: "editor.suggest.showMethods": false. This hides method suggestions from Pylance in the completion list, letting Copilot control the suggestion flow. You can also set "editor.suggest.showFunctions": false if needed. Save the file.
  4. Ensure Copilot inline suggestions are enabled
    Add this line: "editor.inlineSuggest.enabled": true. This is the master switch for inline suggestions. If it is false, Copilot ghost text will not appear. Save the file.
  5. Adjust Pylance type checking mode to basic
    Add this line: "python.analysis.typeCheckingMode": "basic". The default is "off". Setting it to "basic" gives you type checking without aggressive completion interference. If you need strict mode, set it to "strict" but expect more completion overlap. Save the file.
  6. Restart VS Code
    Close VS Code completely and reopen it. This ensures all settings take effect and both extensions reload with the new configuration.

After restarting, test by typing a Python function or variable. Copilot should show inline suggestions without Pylance overlapping. The completion list should show fewer duplicate entries.

ADVERTISEMENT

If Copilot Still Has Issues After the Main Fix

In some cases, the basic settings above are not enough. The following scenarios describe additional problems and their solutions.

Copilot Does Not Show Any Suggestions

If Copilot stops showing inline suggestions after adjusting Pylance settings, check that Copilot is activated for Python files. Open a .py file, click the Copilot icon in the status bar, and ensure it shows Copilot: Enabled. If it is disabled, click the icon to enable it. Also verify that your Copilot subscription is active and signed in.

Pylance Type Hints Still Appear

If you still see Pylance inline hints after setting python.analysis.inlayHints.variableTypes to false, you may need to disable all inlay hints. Add these lines to settings.json: "python.analysis.inlayHints.functionReturnTypes": false and "python.analysis.inlayHints.parameterNames": false. This removes all Pylance inline hints completely.

Completion List Still Shows Duplicates

If the completion list still has duplicate entries, you can disable Pylance completions entirely. Add this line: "python.analysis.completeFunctionParens": false. This stops Pylance from adding parentheses to completions. For more aggressive filtering, set "editor.suggest.filterGraceful": false to remove fuzzy matches from Pylance.

VS Code Runs Slowly After Changes

If performance is still poor, disable Copilot in large files. Add this line: "github.copilot.editor.enableAutoCompletions": false and then manually trigger Copilot with Ctrl+Enter when needed. This reduces background processing. You can also set "python.analysis.indexing": false to stop Pylance from indexing the entire workspace, which saves memory.

Copilot vs Pylance: Key Differences in VS Code

Item GitHub Copilot Pylance
Primary function AI code completion based on context and language model Fast IntelliSense, type checking, and language server for Python
Suggestions source OpenAI Codex model trained on public code Pyright static analysis of your code and type stubs
Inline ghost text Shows as grayed-out text while typing Shows inlay hints for variable types, return types, and parameter names
Completion list entries Appears as Copilot entries in the suggestion widget Appears as standard IntelliSense entries
Performance impact Moderate; uses network calls for suggestions Low to moderate; runs locally and caches analysis
Conflict resolution Disable inline suggestions or adjust completion filtering Disable inlay hints or reduce type checking mode

You now know how to resolve conflicts between GitHub Copilot and Pylance in VS Code. Start by adjusting the settings.json keys for inline hints and completion filtering, then test with a Python file. For persistent issues, disable Pylance inlay hints or reduce Copilot auto-completions in large files. As an advanced tip, use the editor.suggest.preview setting set to true to preview completions from both extensions without committing to them immediately.

ADVERTISEMENT