Skip to content

Commit e545881

Browse files
anton-107claude
andauthored
Improve IDE settings prompt: better formatting and default to yes (#4871)
See #4705 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cc0df53 commit e545881

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
@@ -218,29 +218,33 @@ func validateSettings(v hujson.Value, connectionName string) *missingSettings {
218218
func settingsMessage(connectionName string, missing *missingSettings) string {
219219
var lines []string
220220
if missing.portRange {
221-
lines = append(lines, fmt.Sprintf(" \"%s\": {\"%s\": \"%s\"}", serverPickPortsKey, connectionName, portRange))
221+
lines = append(lines, fmt.Sprintf(" \"%s\": {\"%s\": \"%s\"}", serverPickPortsKey, connectionName, portRange))
222222
}
223223
if missing.platform {
224-
lines = append(lines, fmt.Sprintf(" \"%s\": {\"%s\": \"%s\"}", remotePlatformKey, connectionName, remotePlatform))
224+
lines = append(lines, fmt.Sprintf(" \"%s\": {\"%s\": \"%s\"}", remotePlatformKey, connectionName, remotePlatform))
225225
}
226226
if missing.listenOnSocket {
227-
lines = append(lines, fmt.Sprintf(" \"%s\": true // Global setting that affects all remote ssh connections", listenOnSocketKey))
227+
lines = append(lines, fmt.Sprintf(" \"%s\": true // Global setting", listenOnSocketKey))
228228
}
229229
if len(missing.extensions) > 0 {
230230
quoted := make([]string, len(missing.extensions))
231231
for i, ext := range missing.extensions {
232232
quoted[i] = fmt.Sprintf("\"%s\"", ext)
233233
}
234-
lines = append(lines, fmt.Sprintf(" \"%s\": [%s] // Global setting that affects all remote ssh connections", defaultExtensionsKey, strings.Join(quoted, ", ")))
234+
lines = append(lines, fmt.Sprintf(" \"%s\": [%s] // Global setting", defaultExtensionsKey, strings.Join(quoted, ", ")))
235235
}
236-
return strings.Join(lines, "\n")
236+
return " {\n" + strings.Join(lines, ",\n") + "\n }"
237237
}
238238

239239
func promptUserForUpdate(ctx context.Context, ide, connectionName string, missing *missingSettings) (bool, error) {
240240
question := fmt.Sprintf(
241-
"The following settings will be applied to %s for '%s':\n%s\nApply these settings?",
241+
"The following settings will be applied to %s for '%s':\n\n%s\n\nApply these settings?",
242242
getIDE(ide).Name, connectionName, settingsMessage(connectionName, missing))
243-
return cmdio.AskYesOrNo(ctx, question)
243+
ans, err := cmdio.Ask(ctx, question+" [Y/n]", "y")
244+
if err != nil {
245+
return false, err
246+
}
247+
return strings.ToLower(ans) == "y", nil
244248
}
245249

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

0 commit comments

Comments
 (0)