@@ -22,7 +22,10 @@ import { FolderEvent, FolderOperation, WorkspaceContext } from "./WorkspaceConte
2222import * as commands from "./commands" ;
2323import { resolveFolderDependencies } from "./commands/dependencies/resolve" ;
2424import { registerSourceKitSchemaWatcher } from "./commands/generateSourcekitConfiguration" ;
25- import configuration , { handleConfigurationChangeEvent } from "./configuration" ;
25+ import configuration , {
26+ ConfigurationValidationError ,
27+ handleConfigurationChangeEvent ,
28+ } from "./configuration" ;
2629import { ContextKeys , createContextKeys } from "./contextKeys" ;
2730import { registerDebugger } from "./debugger/debugAdapterFactory" ;
2831import * as debug from "./debugger/launch" ;
@@ -190,10 +193,24 @@ export async function activate(context: vscode.ExtensionContext): Promise<Api> {
190193 } ,
191194 } ;
192195 } catch ( error ) {
193- const errorMessage = getErrorDescription ( error ) ;
194- // show this error message as the VS Code error message only shows when running
195- // the extension through the debugger
196- void vscode . window . showErrorMessage ( `Activating Swift extension failed: ${ errorMessage } ` ) ;
196+ // Handle configuration validation errors with UI that points the user to the poorly configured setting
197+ if ( error instanceof ConfigurationValidationError ) {
198+ void vscode . window . showErrorMessage ( error . message , "Open Settings" ) . then ( selection => {
199+ if ( selection === "Open Settings" ) {
200+ void vscode . commands . executeCommand (
201+ "workbench.action.openSettings" ,
202+ error . settingName
203+ ) ;
204+ }
205+ } ) ;
206+ } else {
207+ const errorMessage = getErrorDescription ( error ) ;
208+ // show this error message as the VS Code error message only shows when running
209+ // the extension through the debugger
210+ void vscode . window . showErrorMessage (
211+ `Activating Swift extension failed: ${ errorMessage } `
212+ ) ;
213+ }
197214 throw error ;
198215 }
199216}
0 commit comments