Skip to content

Commit 9264cad

Browse files
committed
Use LuaLS.field in bitfield
1 parent 2a157be commit 9264cad

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

dist/library/structures/df.jobs.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ function df.job_list_link:new() end
204204
---@field [18] boolean toady: DO_ME_NOW
205205

206206
---@class _job_flags: DFBitfieldType
207-
---@field repeat 0
207+
---@field ["repeat"] 0
208208
---@field [0] "repeat"
209209
---@field suspend 1
210210
---@field [1] "suspend"

lib/parser.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,10 @@ def to_field
284284
# TODO: Ask DFHack folks if this matters, should we be outputting nils.
285285
return '' unless @name
286286

287-
annotation = "---@field #{@name} #{@value}"
288-
annotation << " #{@comment}" if @comment
289-
annotation << "\n"
290-
291-
annotation << "---@field [#{@value}] \"#{@name}\""
292-
annotation << " #{@comment}" if @comment
293-
annotation << "\n"
287+
annotation = []
288+
annotation << LuaLS.field(@name, @value, @comment)
289+
annotation << LuaLS.field(@value, "\"#{@name}\"", @comment)
290+
annotation.join
294291
end
295292

296293
def to_field_bitfield

0 commit comments

Comments
 (0)