Skip to content

Commit

Permalink
fix(toml): parsing section with trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
saecki committed Jul 25, 2024
1 parent c3fd473 commit b7ba6d2
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 @@ -574,7 +574,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 @@ -588,7 +588,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 b7ba6d2

Please sign in to comment.