Skip to content

Commit a39db25

Browse files
Merge pull request #33 from Ferruslogic/develop
v1.3.2
2 parents 777c76b + 980f627 commit a39db25

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "livecodescript",
33
"description": "This extension adds several features to handle livecodescript files",
44
"displayName": "Livecode Language Support",
5-
"version": "1.3.1",
5+
"version": "1.3.2",
66
"author": "FerrusLogic",
77
"publisher": "Ferruslogic",
88
"license": "SEE LICENSE IN LICENSE.md",

tools/Formatter.lc

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function textFormatAsScript pScript, pIndentation, pUseTabs, pMarginInBlankLines
9090
put empty into tFormatArray["handler-indentation"]
9191
put 0 into tFormatArray["num-indent"]
9292
put false into tFormatArray["breakpoint"]
93-
put char 1 to (tFormatArray["indentation"] * 2) of tFormatArray["indentation-chars"] into tFormatArray["other-line-space"]
93+
put char 1 to (tFormatArray["indentation"] ) of tFormatArray["indentation-chars"] into tFormatArray["other-line-space"]
9494
put char 1 to trunc(tFormatArray["indentation"] / 2) of tFormatArray["indentation-chars"] into tFormatArray["else-space"]
9595
put false into tFormatArray["continue-in-other-line"]
9696
put false into tFormatArray["other-line"]
@@ -244,17 +244,40 @@ end _itemClearExtraSpaces
244244

245245

246246
private function _comments pLine, @pCommentML
247-
local tEndCML, tResult
247+
/* If not in a multi-comment block abort */
248+
if not pCommentML then
249+
return pLine
250+
end if
248251

249-
if pCommentML is true and "*/" is in pLine then
252+
/* Compute if this is the closure line */
253+
if "*/" is in pLine then
254+
local tResult
255+
local tEndCML
250256
put offset("*/", pLine) + 1 into tEndCML
251-
put the char 1 to tEndCML of pLine into tResult
257+
put char 1 to tEndCML of pLine into tResult
252258

253259
put false into pCommentML
254260
add 1 to tEndCML
255-
put space & _lineClearExtraSpaces(the char tEndCML to - 1 of pLine, pCommentML) after tResult
261+
put space & _lineClearExtraSpaces( \
262+
the char tEndCML to - 1 of pLine, \
263+
pCommentML) after tResult
264+
put tResult into pLine
265+
end if
256266

257-
return tResult
267+
if "/*" is not in pLine then
268+
/* Ensure multiline middle lines begins with a '*' */
269+
if char 1 of pLine is not "*" then
270+
put "* " before pLine
271+
end if
272+
put space before pLine
273+
else
274+
/* Format the beginning of the block */
275+
local tOffset
276+
put offset("/*",pLine) into tOffset
277+
278+
if char (tOffset + 1) of pLine is not in (space,"*") then
279+
put space after char (tOffset + 1) of pLine
280+
end if
258281
end if
259282

260283
return pLine

0 commit comments

Comments
 (0)