Skip to content

Don't suggest C/C++ DevTools when AI features are disabled - #5165

Open
Zuhair Khalid (zuhairkhalid229) wants to merge 1 commit into
microsoft:mainfrom
zuhairkhalid229:fix/5163-devtools-ai-disabled
Open

Zuhair Khalid (zuhairkhalid229) wants to merge 1 commit into
microsoft:mainfrom
zuhairkhalid229:fix/5163-devtools-ai-disabled

Conversation

@zuhairkhalid229

Copy link
Copy Markdown

Fixes #5163.

With "chat.disableAIFeatures": true, CMake Tools still suggests installing C/C++ DevTools "to give Copilot more accurate code understanding". DevToolsNotification.showIfNeeded only checks whether Copilot is installed, and VS Code ships Copilot bundled, so the check passes even when the user has turned AI features off.

This adds an areAIFeaturesDisabled() check (vscode.workspace.getConfiguration('chat').get<boolean>('disableAIFeatures', false)) to both eligibility guards in showIfNeeded: the first one, so the suggestion is skipped before the bundled-Copilot manifest is read, and the one after isCopilotInstalled(), which already re-checks what can change during that await.

  • On VS Code builds without the setting, get returns the false default, so nothing changes there.
  • Turning AI features on or off enables or disables Copilot, which fires vscode.extensions.onDidChange, and start() already re-checks on that event, so no configuration listener is added.

Testing

New unit test in test/unit-tests/devToolsNotification.test.ts: bundled Copilot (absent from the extension registry, manifest under appRoot) with chat.disableAIFeatures stubbed to true (other configuration sections pass through). It checks that no toast is shown and the bundled manifest isn't read.

I ran this repo's Linux CI workflow (build, lint, backend and unit suites) on my fork:

  • With this change: yarn compile-production-ci and yarn lint pass, backend tests pass, unit tests 410 passing, 4 pending.
  • Same tests with the old src/ui/devToolsNotification.ts: unit tests 409 passing, 1 failing: the new test (AssertionError: expected true to equal false).

Changelog

Added under a new ## 1.26 heading, since 1.25.10 is already released. Happy to move it if you'd rather keep it somewhere else.

chat.disableAIFeatures turns Copilot off, but the suggestion only checked
whether Copilot is installed, which bundled Copilot always is. Skip the
suggestion when the setting is on.

Fixes microsoft#5163
@zuhairkhalid229

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Copilot ad still shows when AI features are disabled

1 participant