From f68ce01e8a2cd35334cb6dd9df79ad91e6ce9562 Mon Sep 17 00:00:00 2001 From: James Meng Date: Tue, 10 Dec 2024 16:22:30 -0800 Subject: [PATCH] Prettier support - dashSeperator --- .../prettier-plugin-liquid/src/printer/print/liquid.ts | 6 +++++- .../src/test/liquid-doc/fixed.liquid | 5 +++++ .../src/test/liquid-doc/index.liquid | 9 +++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/prettier-plugin-liquid/src/printer/print/liquid.ts b/packages/prettier-plugin-liquid/src/printer/print/liquid.ts index 54fae7cc..3882a421 100644 --- a/packages/prettier-plugin-liquid/src/printer/print/liquid.ts +++ b/packages/prettier-plugin-liquid/src/printer/print/liquid.ts @@ -524,7 +524,11 @@ export function printLiquidDocParam( } if (node.paramDescription.value) { - parts.push(' ', node.paramDescription.value); + if (node.paramDescription.dashSeparated) { + parts.push(' - ', node.paramDescription.value); + } else { + parts.push(' ', node.paramDescription.value); + } } return parts; diff --git a/packages/prettier-plugin-liquid/src/test/liquid-doc/fixed.liquid b/packages/prettier-plugin-liquid/src/test/liquid-doc/fixed.liquid index 04662ec8..840cc089 100644 --- a/packages/prettier-plugin-liquid/src/test/liquid-doc/fixed.liquid +++ b/packages/prettier-plugin-liquid/src/test/liquid-doc/fixed.liquid @@ -17,3 +17,8 @@ It should format the param type {% doc %} @param {string} paramName param with description {% enddoc %} + +It should format the param description with a dash separator +{% doc %} + @param paramName - param with description +{% enddoc %} diff --git a/packages/prettier-plugin-liquid/src/test/liquid-doc/index.liquid b/packages/prettier-plugin-liquid/src/test/liquid-doc/index.liquid index aaff7073..e6df063a 100644 --- a/packages/prettier-plugin-liquid/src/test/liquid-doc/index.liquid +++ b/packages/prettier-plugin-liquid/src/test/liquid-doc/index.liquid @@ -10,10 +10,15 @@ It should not dedent to root It should trim whitespace between nodes {% doc %} -@param paramName param with description +@param paramName param with description {% enddoc %} It should format the param type {% doc %} - @param { string } paramName param with description +@param { string } paramName param with description +{% enddoc %} + +It should format the param description with a dash separator +{% doc %} +@param paramName - param with description {% enddoc %}