SideBarTools icon indicating copy to clipboard operation
SideBarTools copied to clipboard

Support brace (`{}`) expansion when creating new files

Open mandx opened this issue 1 year ago • 3 comments

Related to #40 #42

The idea would be that, when selecting "New file...", one could use braces to create sets of files:

  • /some/path/MyComponent.{tsx,scss} would expand to
    • /some/path/MyComponent.tsx
    • /some/path/MyComponent.scss
  • /some/path/my-module{,.test}.tsx would expand to:
    • /some/path/my-module.tsx
    • /some/path/my-module.test.tsx

It would also work on the path components (anywhere in the string, really).

While this would help me a lot personally, there are a few cons to implementing this:

  • I like the no-dependencies aspect of this lib, but since Python's stdlib doesn't support this, we would need to vendor a library to support this (I'm partial to braceexpand)
  • We would need to explain somehow to the user of the new capability, and personally I'm not sure how yet.
  • Should this be gated behind a preference

mandx avatar Jul 21 '22 16:07 mandx

I would say that the mental overhead is only worth it when adding more than two files. Putting in the braces and thinking about the syntax (even remembering it), would probably be slower for me than creating one new file and then duplicating it. Assuming of course you don't do this every day, then it might get handy. If it can live as a "hidden" pro-level trick it won't bother anyone who doesn't use it. It might bother the maintainers of this package though 😄 I think I'd like to see more requests and use cases before deciding to put it in. For instance, is it really common to create both files at once? ... and to they commonly deviate only in small parts (eg. it doesn't look like it will work if your tests are in a different directory).

braver avatar Jul 25 '22 18:07 braver

Those are good point, so now I'm leaning towards closing this ticket for now, and if it regains interest, we can reopen and maybe start work on it. What do you think?

mandx avatar Jul 25 '22 18:07 mandx

Let's leave it open for others to find. Maybe some people will come and add their ideas. If nothing happens for a while, we can always close it later.

braver avatar Jul 25 '22 18:07 braver