Skip to content

Commit b221e9b

Browse files
anton-107claude
andcommitted
Improve IDE settings prompt: better formatting and default to yes
- Wrap settings JSON in { } with proper indentation for visual clarity - Add blank lines around the settings block - Default to yes (Y/n) when prompting to apply settings - Shorten inline comments for less noise Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c2dfd63 commit b221e9b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

experimental/ssh/internal/vscode/settings.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,29 +214,33 @@ func validateSettings(v hujson.Value, connectionName string) *missingSettings {
214214
func settingsMessage(connectionName string, missing *missingSettings) string {
215215
var lines []string
216216
if missing.portRange {
217-
lines = append(lines, fmt.Sprintf(" \"%s\": {\"%s\": \"%s\"}", serverPickPortsKey, connectionName, portRange))
217+
lines = append(lines, fmt.Sprintf(" \"%s\": {\"%s\": \"%s\"}", serverPickPortsKey, connectionName, portRange))
218218
}
219219
if missing.platform {
220-
lines = append(lines, fmt.Sprintf(" \"%s\": {\"%s\": \"%s\"}", remotePlatformKey, connectionName, remotePlatform))
220+
lines = append(lines, fmt.Sprintf(" \"%s\": {\"%s\": \"%s\"}", remotePlatformKey, connectionName, remotePlatform))
221221
}
222222
if missing.listenOnSocket {
223-
lines = append(lines, fmt.Sprintf(" \"%s\": true // Global setting that affects all remote ssh connections", listenOnSocketKey))
223+
lines = append(lines, fmt.Sprintf(" \"%s\": true // Global setting", listenOnSocketKey))
224224
}
225225
if len(missing.extensions) > 0 {
226226
quoted := make([]string, len(missing.extensions))
227227
for i, ext := range missing.extensions {
228228
quoted[i] = fmt.Sprintf("\"%s\"", ext)
229229
}
230-
lines = append(lines, fmt.Sprintf(" \"%s\": [%s] // Global setting that affects all remote ssh connections", defaultExtensionsKey, strings.Join(quoted, ", ")))
230+
lines = append(lines, fmt.Sprintf(" \"%s\": [%s] // Global setting", defaultExtensionsKey, strings.Join(quoted, ", ")))
231231
}
232-
return strings.Join(lines, "\n")
232+
return " {\n" + strings.Join(lines, ",\n") + "\n }"
233233
}
234234

235235
func promptUserForUpdate(ctx context.Context, ide, connectionName string, missing *missingSettings) (bool, error) {
236236
question := fmt.Sprintf(
237-
"The following settings will be applied to %s for '%s':\n%s\nApply these settings?",
237+
"The following settings will be applied to %s for '%s':\n\n%s\n\nApply these settings?",
238238
getIDE(ide).Name, connectionName, settingsMessage(connectionName, missing))
239-
return cmdio.AskYesOrNo(ctx, question)
239+
ans, err := cmdio.Ask(ctx, question+" [Y/n]", "y")
240+
if err != nil {
241+
return false, err
242+
}
243+
return strings.ToLower(ans) == "y", nil
240244
}
241245

242246
func handleMissingFile(ctx context.Context, ide, connectionName, settingsPath string) error {

0 commit comments

Comments
 (0)