Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ignore formatting in some known functions, such as theme
  • Loading branch information
RobinMalfait committed Jul 27, 2023
commit 4b57f829dc7a3f0c17bef1e727e49de2151fa707
7 changes: 7 additions & 0 deletions src/util/dataTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export function normalize(value, isRoot = true) {
* @returns {string}
*/
function normalizeMathOperatorSpacing(value) {
let preventFormattingInFunctions = ['theme']

return value.replace(/(calc|min|max|clamp)\(.+\)/g, (match) => {
let result = ''

Expand Down Expand Up @@ -100,6 +102,11 @@ function normalizeMathOperatorSpacing(value) {
result += consumeUntil([')', ','])
}

// Skip formatting inside known functions
else if (preventFormattingInFunctions.some((fn) => peek(fn))) {
result += consumeUntil([')'])
}

// Handle operators
else if (
['+', '-', '*', '/'].includes(char) &&
Expand Down