Skip to content

Commit

Permalink
fix(toml): parsing section with trailing whitespace (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
saecki committed Jul 25, 2024
1 parent 1643400 commit a8f1f05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/crates/toml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ function M.parse_crates(buf)
local line_nr = i - 1

---@type string, string
local section_start, section_text, section_end = line:match("^%s*()%[(.+)()%s*$")
local section_start, section_text, section_end = line:match("^%s*()%[([^%s]+)()%s*$")
if section_text then
if dep_section then
-- close line span
Expand All @@ -597,7 +597,7 @@ function M.parse_crates(buf)
end

local header_col = Span.new(section_start - 1, section_end - 1)
if section_text and section_text:sub(-1) == ']' then
if section_text and section_text:sub(-1) == "]" then
section_text = section_text:sub(1, -2)
end

Expand Down

0 comments on commit a8f1f05

Please sign in to comment.