@@ -17,7 +17,7 @@ import {
1717import type { SettingsState } from "../types/index" ;
1818import { loadMarketplace } from "./marketplaceManagement" ;
1919import { setDefaultNotificationDuration } from "./notifications" ;
20- import { applyDebugMenuVisibility , applyTerminalFont , applyTheme } from "./themeManagement" ;
20+ import { applyDebugMenuVisibility , applyPreviewFeaturesVisibility , applyTerminalFont , applyTheme } from "./themeManagement" ;
2121import { applyAppearanceSettings , openLocalPageAsTab , registerCloseGuard } from "./toolManagement" ;
2222import { loadSidebarTools } from "./toolsSidebarManagement" ;
2323
@@ -42,6 +42,7 @@ export async function loadSettings(): Promise<void> {
4242 const showEnvironmentColorCheck = document . getElementById ( "sidebar-show-environment-color-check" ) as HTMLInputElement | null ;
4343 const categoryColorThicknessInput = document . getElementById ( "sidebar-category-color-thickness" ) as HTMLInputElement | null ;
4444 const environmentColorThicknessInput = document . getElementById ( "sidebar-environment-color-thickness" ) as HTMLInputElement | null ;
45+ const enablePreviewFeaturesCheck = document . getElementById ( "sidebar-enable-preview-features-check" ) as HTMLInputElement | null ;
4546
4647 if ( themeSelect && autoUpdateCheck && showDebugMenuCheck && deprecatedToolsSelect && toolDisplayModeSelect && terminalFontSelect ) {
4748 const settings = await window . toolboxAPI . getUserSettings ( ) ;
@@ -60,6 +61,7 @@ export async function loadSettings(): Promise<void> {
6061 showEnvironmentColor : settings . showEnvironmentColor ?? DEFAULT_SHOW_ENVIRONMENT_COLOR ,
6162 categoryColorThickness : settings . categoryColorThickness ?? DEFAULT_CATEGORY_COLOR_THICKNESS ,
6263 environmentColorThickness : settings . environmentColorThickness ?? DEFAULT_ENVIRONMENT_COLOR_THICKNESS ,
64+ enablePreviewFeatures : settings . enablePreviewFeatures ?? false ,
6365 } ;
6466
6567 themeSelect . value = settings . theme ;
@@ -87,6 +89,9 @@ export async function loadSettings(): Promise<void> {
8789 if ( environmentColorThicknessInput ) {
8890 environmentColorThicknessInput . value = String ( settings . environmentColorThickness ?? DEFAULT_ENVIRONMENT_COLOR_THICKNESS ) ;
8991 }
92+ if ( enablePreviewFeaturesCheck ) {
93+ enablePreviewFeaturesCheck . checked = settings . enablePreviewFeatures ?? false ;
94+ }
9095
9196 const terminalFont = settings . terminalFont || DEFAULT_TERMINAL_FONT ;
9297
@@ -132,6 +137,7 @@ export async function saveSettings(): Promise<void> {
132137 const showEnvironmentColorCheck = document . getElementById ( "sidebar-show-environment-color-check" ) as HTMLInputElement | null ;
133138 const categoryColorThicknessInput = document . getElementById ( "sidebar-category-color-thickness" ) as HTMLInputElement | null ;
134139 const environmentColorThicknessInput = document . getElementById ( "sidebar-environment-color-thickness" ) as HTMLInputElement | null ;
140+ const enablePreviewFeaturesCheck = document . getElementById ( "sidebar-enable-preview-features-check" ) as HTMLInputElement | null ;
135141
136142 if ( ! themeSelect || ! autoUpdateCheck || ! showDebugMenuCheck || ! deprecatedToolsSelect || ! toolDisplayModeSelect || ! terminalFontSelect ) return ;
137143
@@ -151,6 +157,7 @@ export async function saveSettings(): Promise<void> {
151157 const environmentColorThickness = environmentColorThicknessInput
152158 ? Math . min ( MAX_COLOR_BORDER_THICKNESS , Math . max ( MIN_COLOR_BORDER_THICKNESS , Number ( environmentColorThicknessInput . value ) || DEFAULT_ENVIRONMENT_COLOR_THICKNESS ) )
153159 : DEFAULT_ENVIRONMENT_COLOR_THICKNESS ;
160+ const enablePreviewFeatures = enablePreviewFeaturesCheck ? enablePreviewFeaturesCheck . checked : false ;
154161
155162 const currentSettings = {
156163 theme : themeSelect . value ,
@@ -165,6 +172,7 @@ export async function saveSettings(): Promise<void> {
165172 showEnvironmentColor,
166173 categoryColorThickness,
167174 environmentColorThickness,
175+ enablePreviewFeatures,
168176 } ;
169177
170178 // Only include changed settings in the update
@@ -206,6 +214,9 @@ export async function saveSettings(): Promise<void> {
206214 if ( currentSettings . environmentColorThickness !== originalSettings . environmentColorThickness ) {
207215 changedSettings . environmentColorThickness = currentSettings . environmentColorThickness ;
208216 }
217+ if ( currentSettings . enablePreviewFeatures !== ( originalSettings . enablePreviewFeatures ?? false ) ) {
218+ changedSettings . enablePreviewFeatures = currentSettings . enablePreviewFeatures ;
219+ }
209220
210221 // Only save and emit event if something changed
211222 if ( Object . keys ( changedSettings ) . length > 0 ) {
@@ -215,6 +226,7 @@ export async function saveSettings(): Promise<void> {
215226 applyTheme ( currentSettings . theme ) ;
216227 applyTerminalFont ( currentSettings . terminalFont ) ;
217228 applyDebugMenuVisibility ( currentSettings . showDebugMenu ) ;
229+ applyPreviewFeaturesVisibility ( currentSettings . enablePreviewFeatures ) ;
218230 setDefaultNotificationDuration ( currentSettings . notificationDuration ) ;
219231 applyAppearanceSettings ( currentSettings . showCategoryColor , currentSettings . showEnvironmentColor , currentSettings . categoryColorThickness , currentSettings . environmentColorThickness ) ;
220232
@@ -267,6 +279,7 @@ function hasUnsavedChanges(): boolean {
267279 const showEnvironmentColorCheck = document . getElementById ( "sidebar-show-environment-color-check" ) as HTMLInputElement | null ;
268280 const categoryColorThicknessInput = document . getElementById ( "sidebar-category-color-thickness" ) as HTMLInputElement | null ;
269281 const environmentColorThicknessInput = document . getElementById ( "sidebar-environment-color-thickness" ) as HTMLInputElement | null ;
282+ const enablePreviewFeaturesCheck = document . getElementById ( "sidebar-enable-preview-features-check" ) as HTMLInputElement | null ;
270283
271284 // If the DOM elements aren't present the settings panel isn't rendered — no unsaved changes
272285 if ( ! themeSelect || ! autoUpdateCheck || ! showDebugMenuCheck || ! deprecatedToolsSelect || ! toolDisplayModeSelect || ! terminalFontSelect ) {
@@ -296,6 +309,7 @@ function hasUnsavedChanges(): boolean {
296309 const val = Math . min ( MAX_COLOR_BORDER_THICKNESS , Math . max ( MIN_COLOR_BORDER_THICKNESS , Number ( environmentColorThicknessInput . value ) || DEFAULT_ENVIRONMENT_COLOR_THICKNESS ) ) ;
297310 if ( val !== ( originalSettings . environmentColorThickness ?? DEFAULT_ENVIRONMENT_COLOR_THICKNESS ) ) return true ;
298311 }
312+ if ( enablePreviewFeaturesCheck && enablePreviewFeaturesCheck . checked !== ( originalSettings . enablePreviewFeatures ?? false ) ) return true ;
299313
300314 return false ;
301315}
@@ -513,6 +527,23 @@ export function renderSettingsContent(panel: HTMLElement): void {
513527 </div>
514528 </section>
515529
530+ <section id="settings-section-preview" class="settings-vscode-section">
531+ <h2 class="settings-vscode-section-title">Preview Features</h2>
532+
533+ <div class="settings-vscode-item">
534+ <div class="settings-vscode-item-info">
535+ <label class="settings-vscode-item-label" for="sidebar-enable-preview-features-check">Enable Preview Features</label>
536+ <p class="settings-vscode-item-description">Show experimental and preview features in the UI. These features are still in development and may change or be removed. Currently includes: MCP Server.</p>
537+ </div>
538+ <div class="settings-vscode-item-control">
539+ <label class="settings-vscode-checkbox-label">
540+ <input type="checkbox" id="sidebar-enable-preview-features-check" class="settings-vscode-checkbox" />
541+ <span>Enable</span>
542+ </label>
543+ </div>
544+ </div>
545+ </section>
546+
516547 <div class="settings-vscode-actions">
517548 <button id="sidebar-save-settings-btn" class="fluent-button fluent-button-primary">Save Settings</button>
518549 <span class="settings-vscode-item-description">Changes apply instantly after saving.</span>
0 commit comments