mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 06:27:26 -06:00
single-value-single-line formatting
Need to figure out the regex expression. To only select overrides consisting of a single value
This commit is contained in:
parent
67688aad95
commit
187dfe1210
2 changed files with 4 additions and 0 deletions
|
@ -9,6 +9,7 @@ format:
|
||||||
format-definition-paired-coordinate-array: true
|
format-definition-paired-coordinate-array: true
|
||||||
format-definition-sort-keys: true
|
format-definition-sort-keys: true
|
||||||
format-definition-indent: 4
|
format-definition-indent: 4
|
||||||
|
format-definition-single-value-single-line: true
|
||||||
format-profile-space-around-delimiters: true
|
format-profile-space-around-delimiters: true
|
||||||
format-profile-sort-keys: true
|
format-profile-sort-keys: true
|
||||||
diagnostic-mesh-file-size: 1200000
|
diagnostic-mesh-file-size: 1200000
|
|
@ -48,6 +48,9 @@ def formatFile(file: Path, settings):
|
||||||
newline = re.compile(r"(\B\s+)(\"[\w\"]+)(\:\s\{)")
|
newline = re.compile(r"(\B\s+)(\"[\w\"]+)(\:\s\{)")
|
||||||
content = newline.sub(r"\1\2:\1{", content)
|
content = newline.sub(r"\1\2:\1{", content)
|
||||||
|
|
||||||
|
if settings["format"].get("format-definition-single-value-single-line", True):
|
||||||
|
pass # TODO: format entries in the override section which only define a single value to be on one line
|
||||||
|
|
||||||
if settings["format"].get("format-definition-paired-coordinate-array", True):
|
if settings["format"].get("format-definition-paired-coordinate-array", True):
|
||||||
paired_coordinates = re.compile(r"(\[)\s+(-?\d*),\s*(-?\d*)\s*(\])")
|
paired_coordinates = re.compile(r"(\[)\s+(-?\d*),\s*(-?\d*)\s*(\])")
|
||||||
content = paired_coordinates.sub(r"\1 \2, \3 \4", content)
|
content = paired_coordinates.sub(r"\1 \2, \3 \4", content)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue