ComfyUI-Autocomplete-Plus icon indicating copy to clipboard operation
ComfyUI-Autocomplete-Plus copied to clipboard

fix: skip auto-formatting JSON inputs

Open Moeblack opened this issue 10 months ago • 1 comments

Summary

  • Skip auto-formatting for JSON-like textarea content to avoid corrupting structural commas in JSON.
  • Add a unit test covering JSON input.

Why

Autocomplete-Plus auto-formatting is designed for comma-separated prompt tags. When users paste JSON into a multiline textarea (e.g. used as structured prompt schema), formatting on blur can remove JSON commas and break the JSON.

Test plan

  • npm test

Moeblack avatar Feb 02 '26 13:02 Moeblack

Thank you for the review and the suggestions.

I have applied the changes to use \JSON.parse\ for JSON detection and added the unit tests for the \comfyui-prompt-control\ scheduling syntax.

During testing, the scheduling syntax tests initially failed because the original \wordCommaPattern\ (/\w+\s*,/g) did not match the closing bracket ]. I updated the regex to /[^\s,]+\s*,/g\ to ensure these tokens are correctly captured. All tests are now passing.

Please let me know if anything else is needed.

Moeblack avatar Feb 23 '26 07:02 Moeblack