Skip to content

Accept both simple string and list of strings in args fields for debug config#191

Merged
playdohface merged 1 commit intozed-extensions:mainfrom
playdohface:190-allow-list-or-space-separated-string-for-cmd-args
Feb 16, 2026
Merged

Accept both simple string and list of strings in args fields for debug config#191
playdohface merged 1 commit intozed-extensions:mainfrom
playdohface:190-allow-list-or-space-separated-string-for-cmd-args

Conversation

@playdohface
Copy link
Collaborator

Fixes #190

Adds a new type for leniently deserialized argument-lists. Users can supply either a single string (with whitespace-separated args) or a list of strings (commonly this would be an element for each argument, but mix and match will work as well). Since we only pass these on we simply join them by space upon serializing them back to a string.

Comment on lines +406 to +415
/// A type that can be deserialized from either a single string or a list of strings.
///
/// When serialized, it always produces a single string. If it was a list,
/// the elements are joined with a space.
#[derive(Deserialize, Debug, Clone)]
#[serde(untagged)]
pub enum ArgsStringOrList {
String(String),
List(Vec<String>),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice touch for adopting the multiple args while maintaining compatibility

Comment on lines +423 to +424
ArgsStringOrList::String(s) => serializer.serialize_str(s),
ArgsStringOrList::List(l) => serializer.serialize_str(&l.join(" ")),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider trimming the string or single elements in the list before joining?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, we could but I don't really see how that gives us anything. Command-line-args are generally separated by "any amount of whitespace" and if users have trailing and/or leading spaces they work just as well. Personally I'd keep the Serializer as stupid as possible so nobody needs to think twice about what it's doing

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good, if things are going to work regardless of whitespaces there's not reason not to merge this

@playdohface playdohface merged commit 82ee084 into zed-extensions:main Feb 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow array of VMArgs to be passed into the debug tasks

2 participants