Skip to content

Commit 12d2505

Browse files
Merge branch 'CommentPluginFix' into dev
2 parents d9839fc + 4d8a040 commit 12d2505

File tree

3 files changed

+29
-12
lines changed

3 files changed

+29
-12
lines changed

.github/workflows/nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
fetch-tags: true
2626

2727
- name: Build
28-
run: tools/cross-compile.sh
28+
run: tools/cross-compile.sh nightly
2929

3030
- name: Tag
3131
uses: rickstaa/action-create-tag@v1

runtime/plugins/comment/comment.lua

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,34 @@ ft["zig"] = "// %s"
6161
ft["zscript"] = "// %s"
6262
ft["zsh"] = "# %s"
6363

64-
local last_ft
64+
function updateCommentType(bp)
65+
-- This is the first time doing comment in this bp
66+
if bp.Settings["commentfiletype"] == nil then
67+
-- If commenttype is not registered, use the comment table we have
68+
if bp.Settings["commenttype"] == nil then
69+
if ft[bp.Settings["filetype"]] ~= nil then
70+
bp.Settings["commenttype"] = ft[bp.Settings["filetype"]]
71+
else
72+
bp.Settings["commenttype"] = "# %s"
73+
end
74+
-- Otherwise if the commenttype is registered, that means this is coming from the settings,
75+
-- or set manually by the user. We should update our comment table
76+
else
77+
ft[bp.Settings["filetype"]] = bp.Settings["commenttype"]
78+
end
79+
-- Update filetype
80+
bp.Settings["commentfiletype"] = bp.Settings["filetype"]
6581

66-
function updateCommentType(buf)
67-
if buf.Settings["commenttype"] == nil or (last_ft ~= buf.Settings["filetype"] and last_ft ~= nil) then
68-
if ft[buf.Settings["filetype"]] ~= nil then
69-
buf.Settings["commenttype"] = ft[buf.Settings["filetype"]]
82+
-- Otherwise, check if the filetype has changed manually. If so, use the comment table
83+
elseif bp.Settings["commentfiletype"] ~= bp.Settings["filetype"] then
84+
if ft[bp.Settings["filetype"]] ~= nil then
85+
bp.Settings["commenttype"] = ft[bp.Settings["filetype"]]
7086
else
71-
buf.Settings["commenttype"] = "# %s"
87+
bp.Settings["commenttype"] = "# %s"
7288
end
7389

74-
last_ft = buf.Settings["filetype"]
90+
-- Update filetype
91+
bp.Settings["commentfiletype"] = bp.Settings["filetype"]
7592
end
7693
end
7794

tools/cross-compile.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
set -e
44

5-
HASH="$(git rev-parse --short HEAD)"
6-
VERSION="$(go run tools/build-version.go)"
7-
DATE="$(go run tools/build-date.go)"
8-
ADDITIONAL_GO_LINKER_FLAGS="$(go run tools/info-plist.go $VERSION)"
5+
VERSION="$1"
6+
if [ -z "$VERSION" ]; then
7+
VERSION="$(go run tools/build-version.go)"
8+
fi
99

1010
mkdir -p binaries
1111
mkdir -p micro-$VERSION

0 commit comments

Comments
 (0)