Skip to content

"chat.disableAIFeatures" does not disable Copilot Context Provider registration #14294

Description

Environment

  • OS and Version: Microsoft Windows [Version 10.0.19045.7058]
  • VS Code Version: 1.111.0 (user setup)
  • C/C++ Extension Version: 1.30.5
  • If using SSH remote, specify OS of remote machine: -

Bug Summary and Steps to Reproduce

Bug Summary:

Copilot Completion Context Provider registration is attempted even if the user has disabled AI feature ("chat.disableAIFeatures").

Steps to Reproduce:

  1. Have C/C++ extension installed in VS Code.

  2. Configure your VS Code installation to disable any AI feature (set "chat.disableAIFeatures" to true, uninstall any Copilot extension, and disallow them). Relevant settings.json entries:

    {
      "chat.disableAIFeatures": true,
      "extensions.allowed": {
        "GitHub.copilot": false,
        "GitHub.copilot-chat": false,
        "*": true
    },
  3. Open the source code of an extension

  4. Run the extension in debug mode (F5, "Debug: Start Debugging")

  5. Without any ohter interaction, the following Copilot-related messages (blue color) appear in the Debug Console:

    Failed to register the Copilot Context Provider with Copilot client.
    Failed to register the Copilot Context Provider with Copilot Chat.
    

Those messages can be found at https://github.com/microsoft/vscode-cpptools/blob/main/Extension/src/LanguageServer/copilotCompletionContextProvider.ts#L469 and https://github.com/microsoft/vscode-cpptools/blob/main/Extension/src/LanguageServer/copilotCompletionContextProvider.ts#L469

Expected behavior:

Extension should respect "chat.disableAIFeatures" user setting and cleanly avoid attempting Copilot Completion Context Provider registration instead of attempting it, and logging two errors.

Configuration and Logs

{
    "configurations": [
        {
            "name": "Win32",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "intelliSenseMode": "${default}"
        }
    ],
    "version": 4
}

Other Extensions

No response

Additional context

No response

Activity

sean-mcmanus commented on Mar 17, 2026

@sean-mcmanus
Contributor

Néstor Sancho (@theNestruo) Isn't that just logged when debugging? Those are not error messages, but normal debug logging. We don't own those other settings so it's not clear to me that we should be checking those versus detecting the failure. The registration fails regardless.

sean-mcmanus commented on Mar 18, 2026

@sean-mcmanus
Contributor

Néstor Sancho (@theNestruo) It looks like this is the only spot our extension uses console.debug so we can just remove it: #14296

Uh...well, that PR avoids the error, but we still attempt the registration and fail...but as mentioned earlier, that seems like "by design" to me (the owner of the setting is checking it and returning the result to us as a failure to register).

added
fixedCheck the Milestone for the release in which the fix is or will be available.
on Mar 18, 2026

theNestruo commented on Mar 18, 2026

@theNestruo
Author

@theNestruo Isn't that just logged when debugging? Those are not error messages, but normal debug logging.

Yes, you are right. I was unable to reproduce it other way, but did not associate it to be a debug-only message. Sorry!

Uh...well, that PR avoids the error, but we still attempt the registration and fail...but as mentioned earlier, that seems like "by design" to me (the owner of the setting is checking it and returning the result to us as a failure to register).

It's OK, I guess... I was expecting VS Code to provide some flag to the extensions to notify the extension that the user has opted out of AI features, but it seems I was wrong. And while explicitly checking vscode.workspace.getConfiguration("chat").get("disableAIFeatures") is possible, it is definitely hacky.

Thank you very much for taking a look and fixing it! :)

sean-mcmanus commented on Mar 24, 2026

@sean-mcmanus
Contributor
locked and limited conversation to collaborators on May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Feature: Copilot ContextIntegration with GitHub Copilot that provides additional context infoLanguage ServiceenhancementImprovement to an existing featurefixedCheck the Milestone for the release in which the fix is or will be available.

Type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions