-
Notifications
You must be signed in to change notification settings - Fork 37.7k
Hardcode commonly used settings and remove productService dependency #291987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: rzhao271 <[email protected]>
Co-authored-by: rzhao271 <[email protected]>
Co-authored-by: rzhao271 <[email protected]>
…ectly Co-authored-by: rzhao271 <[email protected]>
|
@copilot update src/vs/workbench/services/preferences/browser/preferencesService.ts to also reference new COMMONLY_USED_SETTINGS. |
Co-authored-by: rzhao271 <[email protected]>
|
@copilot remove getMostCommonlyUsedSettings function and just use the constant |
…TINGS directly Co-authored-by: rzhao271 <[email protected]>
|
@copilot undo the changes in src/vs/workbench/services/preferences/browser/preferencesService.ts but then update the hardcoded list to match the existing one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR centralizes the “commonly used settings” list into a single hardcoded constant and removes reliance on productService.commonlyUsedSettings, including adding GitHub.copilot.manageExtension to the list.
Changes:
- Introduced a shared
COMMONLY_USED_SETTINGSconstant and switched callers to use it. - Updated
getExperimentalExtensionToggleDatato no longer depend onproductService.commonlyUsedSettings. - Removed the duplicated “most commonly used settings” list from
PreferencesService.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/services/preferences/browser/preferencesService.ts | Replaces the local “most commonly used” list with the shared constant (but introduces a services → contrib import). |
| src/vs/workbench/contrib/preferences/common/preferences.ts | Adds COMMONLY_USED_SETTINGS and returns it from getExperimentalExtensionToggleData instead of reading from productService. |
| src/vs/workbench/contrib/preferences/browser/settingsLayout.ts | Removes the local default list and uses COMMONLY_USED_SETTINGS as the default for the “Commonly Used” TOC section. |
| export const COMMONLY_USED_SETTINGS: string[] = [ | ||
| 'editor.fontSize', | ||
| 'editor.formatOnSave', | ||
| 'files.autoSave', | ||
| 'GitHub.copilot.manageExtension', | ||
| 'editor.defaultFormatter', |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COMMONLY_USED_SETTINGS is exported as a mutable string[] and is returned (and cached) by getExperimentalExtensionToggleData. Since callers receive the same array reference, accidental mutation would affect all subsequent consumers. Consider typing it as readonly string[]/ReadonlyArray<string> and/or returning a defensive copy when exposing it on ExtensionToggleData.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in c001c58. Changed COMMONLY_USED_SETTINGS to readonly string[] and updated ExtensionToggleData.commonlyUsed and function parameters to use readonly string[] to prevent accidental mutations.
…ch COMMONLY_USED_SETTINGS Co-authored-by: rzhao271 <[email protected]>
Done in 9ba80e3. Reverted |
Co-authored-by: rzhao271 <[email protected]>
| 'editor.fontSize', | ||
| 'editor.formatOnSave', | ||
| 'files.autoSave', | ||
| 'GitHub.copilot.manageExtension', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot remove this setting from this list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in daf357c. Removed GitHub.copilot.manageExtension from the getMostCommonlyUsedSettings() list in preferencesService.ts.
Co-authored-by: rzhao271 <[email protected]>
|
To-do before merge: test in OSS |
Moves commonly used settings list from
productService.commonlyUsedSettingsto a hardcoded constantCOMMONLY_USED_SETTINGS, addingGitHub.copilot.manageExtensionto the list in the contrib layer.Changes
New constant:
COMMONLY_USED_SETTINGSincontrib/preferences/common/preferences.tsas a readonly array to prevent accidental mutations:Removed productService dependency:
getExperimentalExtensionToggleDatanow checks onlyproductService.extensionRecommendations(removed&& productService.commonlyUsedSettingscondition)Updated files:
settingsLayout.ts: UsesCOMMONLY_USED_SETTINGSdirectly as default parameter with readonly type (removeddefaultCommonlyUsedSettingsvariable)preferences.ts:getExperimentalExtensionToggleDatausesCOMMONLY_USED_SETTINGSdirectly;ExtensionToggleData.commonlyUsedtyped asreadonly string[]preferencesService.ts: UpdatedgetMostCommonlyUsedSettings()method with a similar list (excludesGitHub.copilot.manageExtensionto maintain proper layering between services and contrib)Type Safety: Made
COMMONLY_USED_SETTINGSreadonly to prevent accidental mutations that could affect all consumers. Updated all type signatures to usereadonly string[]for consistency.This ensures consistency across the codebase with
COMMONLY_USED_SETTINGSas the single source of truth for the contrib layer, while maintaining the existing architecture and proper layering between services and contrib layers.Original prompt
Created from VS Code.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.