Skip to content

Commit dca1ab1

Browse files
authored
Fix ACD-19624: we should not append extra whitespace before right paren at the end of line (#139)
Fix ACD-19624: we should not append extra whitespace before right paren at the end of line (#139)
1 parent 736e298 commit dca1ab1

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

extension/src/format/sexpression.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -822,8 +822,12 @@ export class Sexpression extends LispAtom {
822822
}
823823

824824
// Last atom may be )
825-
if (hasCloseParen)
826-
res += this.formatLastAtom(startColumn, columnWidth, this.isMultilineString(res));
825+
if (hasCloseParen) {
826+
let str2Append = this.formatLastAtom(startColumn, columnWidth, this.isMultilineString(res));
827+
if(str2Append === ')')
828+
res = res.trimRight(); // to avoid extra whitespace before the closing paren.
829+
res += str2Append;
830+
}
827831

828832
return res;
829833
}

extension/src/test/Baseline/formatedBasefile16.lsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
(defun c:flower (/ R1 n1 n2 pt1 pt2 pt3 pt4 pt5)
33
(princ "中文测试")
44
(setq lst '("abc" nil nil 1 nil 10 nil 12))
5-
(setq centerPt0 (getpoint "\n Please pick point in screen" )
5+
(setq centerPt0 (getpoint "\n Please pick point in screen")
66
R1 5
77
R2 (* 2 R1)
88
R3 R1

extension/src/test/Baseline/formatedBasefile5.lsp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
)
44

55
(defun *error* (msg)
6-
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*") )
6+
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
77
(princ (strcat "\nError: " msg))
88
)
99
(princ)

0 commit comments

Comments
 (0)