Saving action without ID immediately erases it; no warning/error #21969

Closed
opened 2026-01-31 07:59:39 +00:00 by claunia · 5 comments
Owner

Originally created by @carlos-zamora on GitHub (Jul 12, 2024).

Windows Terminal version

1.22.1831.0

Windows build number

26250.5000

Other Software

N/A

Steps to reproduce

  1. open settings.json
  2. in actions add the following:
        {
            "command": {
                "action": "openSuggestions",
                "source": "all",
                "useCommandline": false
            }
        },

Expected Behavior

A warning should appear saying that the JSON is invalid and Terminal should either (1) ignore the changes or (2) fall back to default settings

Actual Behavior

settings.json is immediately rewritten and the text I just added in disappeared!

Originally created by @carlos-zamora on GitHub (Jul 12, 2024). ### Windows Terminal version 1.22.1831.0 ### Windows build number 26250.5000 ### Other Software N/A ### Steps to reproduce 1. open settings.json 2. in `actions` add the following: ```js { "command": { "action": "openSuggestions", "source": "all", "useCommandline": false } }, ``` ### Expected Behavior A warning should appear saying that the JSON is invalid and Terminal should either (1) ignore the changes or (2) fall back to default settings ### Actual Behavior settings.json is immediately rewritten and the text I just added in disappeared!
Author
Owner

@DHowett commented on GitHub (Jul 12, 2024):

I don't understand - it should have been assigned an ID, right?

@DHowett commented on GitHub (Jul 12, 2024): I don't understand - it should have been assigned an ID, right?
Author
Owner

@carlos-zamora commented on GitHub (Jul 12, 2024):

Oh totally. The JSON snippet is intentionally invalid because it's missing an ID. But, in the past, invalid JSON settings throw a warning/error when they get loaded and we don't overwrite the settings.json. For some reason, in this case, we do, and the invalid JSON that gets added disappears.

Also, given that the actions/keybindings split is relatively new, I'm concerned that this is a common case users may hit. I just wanted to add openSuggestions to the command palette, so I added the command without a keybinding attached (common practice before the split). Instead, I immediately had the snippet deleted upon saving the file.

@carlos-zamora commented on GitHub (Jul 12, 2024): Oh totally. The JSON snippet is intentionally invalid because it's missing an ID. But, in the past, invalid JSON settings throw a warning/error when they get loaded and we don't overwrite the settings.json. For some reason, in this case, we do, and the invalid JSON that gets added disappears. Also, given that the `actions`/`keybindings` split is relatively new, I'm concerned that this is a common case users may hit. I just wanted to add `openSuggestions` to the command palette, so I added the command without a keybinding attached (common practice before the split). Instead, I immediately had the snippet deleted upon saving the file.
Author
Owner

@DHowett commented on GitHub (Jul 12, 2024):

Sorry, I mean: shouldn't the "expected behavior" be that we ADD an ID automatically?

@DHowett commented on GitHub (Jul 12, 2024): Sorry, I mean: shouldn't the "expected behavior" be that we ADD an ID automatically?
Author
Owner

@carlos-zamora commented on GitHub (Jul 12, 2024):

ah, good call. yeah!

@carlos-zamora commented on GitHub (Jul 12, 2024): ah, good call. yeah!
Author
Owner

@carlos-zamora commented on GitHub (Aug 13, 2024):

Looked into this further. Turns out, openSuggestions doesn't exist. The actual key is supposed to be showSuggestions.

Thus, closing.

@carlos-zamora commented on GitHub (Aug 13, 2024): Looked into this further. Turns out, `openSuggestions` doesn't exist. The actual key is supposed to be `showSuggestions`. Thus, closing.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21969