Skip to content

Commit

Permalink
fix: add vim to parser globals
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent 667b010 commit 6077342
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/trouble/config/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function M.parse(input)
end
local ok, err = pcall(function()
local code = table.concat(lines, "\n")
env.vim = vim
-- selene: allow(incorrect_standard_library_use)
local chunk = load(code, "trouble", "t", env)
chunk()
Expand Down
4 changes: 4 additions & 0 deletions tests/parser_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ describe("Input is parsed correctly", function()
input = [[a.b = "c"]],
expected = { opts = { a = { b = "c" } }, errors = {}, args = {} },
},
{
input = [[vim=vim.diagnostic.severity.ERROR]],
expected = { opts = { vim = vim.diagnostic.severity.ERROR }, errors = {}, args = {} },
},
{
input = [[x.y.z = "value" a.b = 2]],
expected = { opts = { x = { y = { z = "value" } }, a = { b = 2 } }, errors = {}, args = {} },
Expand Down

0 comments on commit 6077342

Please sign in to comment.