Skip to content

Commit

Permalink
Merge pull request #33 from Ferruslogic/develop
Browse files Browse the repository at this point in the history
v1.3.2
  • Loading branch information
WilliamDelRey committed Apr 11, 2024
2 parents 777c76b + 980f627 commit a39db25
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "livecodescript",
"description": "This extension adds several features to handle livecodescript files",
"displayName": "Livecode Language Support",
"version": "1.3.1",
"version": "1.3.2",
"author": "FerrusLogic",
"publisher": "Ferruslogic",
"license": "SEE LICENSE IN LICENSE.md",
Expand Down
35 changes: 29 additions & 6 deletions tools/Formatter.lc
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function textFormatAsScript pScript, pIndentation, pUseTabs, pMarginInBlankLines
put empty into tFormatArray["handler-indentation"]
put 0 into tFormatArray["num-indent"]
put false into tFormatArray["breakpoint"]
put char 1 to (tFormatArray["indentation"] * 2) of tFormatArray["indentation-chars"] into tFormatArray["other-line-space"]
put char 1 to (tFormatArray["indentation"] ) of tFormatArray["indentation-chars"] into tFormatArray["other-line-space"]
put char 1 to trunc(tFormatArray["indentation"] / 2) of tFormatArray["indentation-chars"] into tFormatArray["else-space"]
put false into tFormatArray["continue-in-other-line"]
put false into tFormatArray["other-line"]
Expand Down Expand Up @@ -244,17 +244,40 @@ end _itemClearExtraSpaces


private function _comments pLine, @pCommentML
local tEndCML, tResult
/* If not in a multi-comment block abort */
if not pCommentML then
return pLine
end if

if pCommentML is true and "*/" is in pLine then
/* Compute if this is the closure line */
if "*/" is in pLine then
local tResult
local tEndCML
put offset("*/", pLine) + 1 into tEndCML
put the char 1 to tEndCML of pLine into tResult
put char 1 to tEndCML of pLine into tResult

put false into pCommentML
add 1 to tEndCML
put space & _lineClearExtraSpaces(the char tEndCML to - 1 of pLine, pCommentML) after tResult
put space & _lineClearExtraSpaces( \
the char tEndCML to - 1 of pLine, \
pCommentML) after tResult
put tResult into pLine
end if

return tResult
if "/*" is not in pLine then
/* Ensure multiline middle lines begins with a '*' */
if char 1 of pLine is not "*" then
put "* " before pLine
end if
put space before pLine
else
/* Format the beginning of the block */
local tOffset
put offset("/*",pLine) into tOffset

if char (tOffset + 1) of pLine is not in (space,"*") then
put space after char (tOffset + 1) of pLine
end if
end if

return pLine
Expand Down

0 comments on commit a39db25

Please sign in to comment.