Skip to content

Commit

Permalink
Complete quote when comma on left
Browse files Browse the repository at this point in the history
  • Loading branch information
mgnsk committed Jun 18, 2024
1 parent 517e782 commit 2afb81d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lua/dumb-autopairs/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ end
--- @param s string
--- @return boolean
local function has_operator_suffix(s)
return hassuffix(s, { "=", ":" })
return hassuffix(s, { "=", ":", "," })
end

local M = {}
Expand Down
10 changes: 8 additions & 2 deletions tests/quotes_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ local data = {
},
{
name = "pair when operator on left",
before = [[=|]],
before = [[= |]],
feed = [[a"]],
after = { [[="|"]] },
after = { [[= "|"]] },
},
{
name = "pair when comma on left",
before = [[, |]],
feed = [[a"]],
after = { [[, "|"]] },
},
}

Expand Down

0 comments on commit 2afb81d

Please sign in to comment.