fix: env is optional field

This commit is contained in:
zizhou teng (n451) 2026-01-28 15:05:34 +00:00
parent ec0ec4a103
commit b0b15b969b
2 changed files with 2 additions and 2 deletions

View file

@ -28,7 +28,7 @@ error('Cannot require a meta file')
---@field queries? string
---
---Envrionment variables for generating the parser
---@field env table<string, string|number>
---@field env? table<string, string|number>
---@class ParserInfo
---

View file

@ -167,7 +167,7 @@ end
---@param compile_location string
---@return string? err
local function do_generate(logger, repo, compile_location)
local env = vim.tbl_extend('force', { TREE_SITTER_JS_RUNTIME = 'native' }, repo.env)
local env = vim.tbl_extend('force', { TREE_SITTER_JS_RUNTIME = 'native' }, repo.env or {})
local from_json = true
if repo.generate_from_json == false then
from_json = false