Skip to content

Commit 6575760

Browse files
anton-107claude
andauthored
Improve IDE settings prompt formatting and default to yes (#4705)
## Summary - Wrap the settings JSON preview in `{ }` with proper indentation so it stands out visually - Add blank lines around the settings block for padding - Default the "Apply these settings?" prompt to yes (`[Y/n]`) — pressing Enter accepts - Shorten inline comments (`// Global setting` instead of `// Global setting that affects all remote ssh connections`) Stacked on #4701. ## Test plan - [x] Existing vscode settings tests pass - [ ] Manual test: verify the prompt renders with proper formatting and padding - [ ] Manual test: pressing Enter without typing accepts the settings 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c73e523 commit 6575760

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

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

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

0 commit comments

Comments
 (0)