terrastruct / d2-vscode

VSCode extension for D2 files.
https://d2lang.com
BSD 3-Clause "New" or "Revised" License
240 stars 11 forks source link

Allow for setting Layout, Theme and Sketch options per document #123

Open asanjabi opened 1 year ago

asanjabi commented 1 year ago

If there a none option in the settings, then user would have the option of setting these values through the variables per document. Or maybe an option for the CLI to reverse the override priority to document over CLI parameters.

alixander commented 1 year ago

ah i didn't realize this wasn't working in d2 preview.

Screen Shot 2023-08-30 at 4 26 20 AM

indeed, i suspect that this extension is passing in default values through the CLI, which takes priority. Instead, they should be omitted, which will let the variable configurations take priority over default values

BarryNolte commented 1 year ago

@alixander So the solution is to have a "none" option in the theme and sketch options, that would then omit the CLI options? What about layout?

asanjabi commented 1 year ago

I think the same pattern would work for layout also, I'd love to see that as an option :)

alixander commented 1 year ago

@alixander So the solution is to have a "none" option in the theme and sketch options, that would then omit the CLI options? What about layout?

No the solution is to just omit the flags if they are default.

artk42 commented 4 months ago

setting render layout engine per document is crucial obviously, a lot of hassle brings that vars not working as expected. Curios why it's working correctly on d2 Playground, which is also VSCode based

SimonSchick commented 2 weeks ago

We started playing with the vscode extension but ran into this as well, we locally edited the extension to make this work but this is obviously not a sustainable solution, imo the vscode settings should not override the project settings.