From e4480dbb24d4a499e78398b7c2164e4f73b15c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nurullah=20Ak=C4=B1n?= Date: Wed, 14 May 2025 17:33:55 +0300 Subject: [PATCH 1/3] (typo) beautify.ts: reapeat -> repeat --- client/src/language/beautify.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/language/beautify.ts b/client/src/language/beautify.ts index b98d965..ca6d2ae 100644 --- a/client/src/language/beautify.ts +++ b/client/src/language/beautify.ts @@ -65,7 +65,7 @@ export class BeautifySmarty { let line = lines[i]; // detect smarty tags - let reapeat = startedRegions.length; + let repeat = startedRegions.length; let startMatch = []; let middleMatch = []; @@ -87,10 +87,10 @@ export class BeautifySmarty { if (startMatch.length) { startedRegions.push(startMatch[0]); } else if (middleMatch.length) { - reapeat--; + repeat--; } else if (endMatch.length) { startedRegions.pop(); - reapeat--; + repeat--; } // indent smarty block @@ -104,7 +104,7 @@ export class BeautifySmarty { lines.splice(i, 1, ...newLines); } - lines[i] = indent_char.repeat(Math.max(0, reapeat)) + lines[i]; + lines[i] = indent_char.repeat(Math.max(0, repeat)) + lines[i]; i += 1; } From 77777a5ee0d74dc34871ebeca8119928fc960b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nurullah=20Ak=C4=B1n?= Date: Thu, 15 May 2025 12:21:56 +0300 Subject: [PATCH 2/3] (style) beautify.ts: prettier auto-format --- client/src/language/beautify.ts | 306 +++++++++++++++++--------------- 1 file changed, 167 insertions(+), 139 deletions(-) diff --git a/client/src/language/beautify.ts b/client/src/language/beautify.ts index ca6d2ae..bca6496 100644 --- a/client/src/language/beautify.ts +++ b/client/src/language/beautify.ts @@ -1,145 +1,173 @@ -import { FormattingOptions } from 'vscode'; +import { FormattingOptions } from "vscode"; import { FormattingLiterals, FormattingTags } from "../interfaces"; import { CONFIG } from "../configuration"; const beautify = require("../js-beautify").html; export class BeautifySmarty { - - private literals: FormattingLiterals = { - strings: /"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`(?:\\.|[^`\\])*`/, - smartyComment: /{\*[\s\S]*?\*}/, - htmlComment: //, - cssComment: /\/\*[\s\S]*?\*\//, - scriptTemplate: /