Antyos / vscode-openscad

An OpenSCAD extension for VS Code
GNU General Public License v3.0
118 stars 18 forks source link

[FEATURE REQUEST] Add date and time variables to "Auto Naming Format" #55

Closed leo-nightfever closed 8 months ago

leo-nightfever commented 9 months ago

I love this project and it really improved my OpenSCAD workflow.

I just went through the settings and found the Auto Naming Format. My usual export name is _filenameyyyyMMdd-mmhh.stl which I do by hand at the moment.

Thanks in advance!

EDIT: I did look through your documentation as well as the linked one from VisualStudio, but this doesn't seem to be implemented yet.

Antyos commented 9 months ago

Thanks for the feature request! Yes, this has been on my todo list since the very beginning of making this extension, I've just never gotten around to it.

The templating is handled by https://github.com/Antyos/vscode-openscad/blob/master/src/export/variable-resolver.ts. It would be a fairly straightforward process to implement. I'm thinking of using the syntax ${date:YYYY-MM-DD}, or whatever other tokens you want. Luxon seems like a good library that supports this: https://moment.github.io/luxon/#/formatting?id=table-of-tokens. I think I was waiting to implement variable substitution as described in #51, but implementation of dates is significantly easier.

I'm not sure when I'll have time to implement this (I'm about to go out of town for a week), but I may have time after I get back.