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

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