diff --git a/CHANGELOG.md b/CHANGELOG.md index 87988dc1..51e09b24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - DAP: Use deep copies of dap configs. +- DAP: Bad config validation: `dap.configuration.env` should be + a `table`, not a `string`. ## [4.7.4] - 2024-02-19 diff --git a/doc/rustaceanvim.txt b/doc/rustaceanvim.txt index 011fa32f..f4797a7e 100644 --- a/doc/rustaceanvim.txt +++ b/doc/rustaceanvim.txt @@ -281,11 +281,17 @@ DapClientConfig *DapClientConfig* {cwd?} (string) Current working directory {program?} (string) Path to executable for most DAP clients {args?} (string[]) Optional args to DAP client, not valid for all client types - {env?} (string) Environmental variables + {env?} (EnvironmentMap) Environmental variables {initCommands?} (string[]) Initial commands to run, `lldb` clients only {coreConfigs?} (table) Essential config values for `probe-rs` client, see https://probe.rs/docs/tools/debugger/ +EnvironmentMap *EnvironmentMap* + + Type: ~ + table + + dap_config_request_launch *dap_config_request_launch* Type: ~ diff --git a/lua/rustaceanvim/config/check.lua b/lua/rustaceanvim/config/check.lua index 464764f9..7bd2c367 100644 --- a/lua/rustaceanvim/config/check.lua +++ b/lua/rustaceanvim/config/check.lua @@ -146,7 +146,7 @@ function M.validate(cfg) cwd = { configuration.cwd, 'string', true }, program = { configuration.program, 'string', true }, args = { configuration.args, 'table', true }, - env = { configuration.env, 'string', true }, + env = { configuration.env, 'table', true }, initCommands = { configuration.initCommands, 'string', true }, coreConfigs = { configuration.coreConfigs, 'table', true }, }) diff --git a/lua/rustaceanvim/config/init.lua b/lua/rustaceanvim/config/init.lua index b1355abd..f344b064 100644 --- a/lua/rustaceanvim/config/init.lua +++ b/lua/rustaceanvim/config/init.lua @@ -145,10 +145,12 @@ vim.g.rustaceanvim = vim.g.rustaceanvim ---@field cwd? string Current working directory ---@field program? string Path to executable for most DAP clients ---@field args? string[] Optional args to DAP client, not valid for all client types ----@field env? string Environmental variables +---@field env? EnvironmentMap Environmental variables ---@field initCommands? string[] Initial commands to run, `lldb` clients only ---@field coreConfigs? table Essential config values for `probe-rs` client, see https://probe.rs/docs/tools/debugger/ +---@alias EnvironmentMap table + ---@alias dap_config_request_launch "launch" ---@alias dap_config_request_attach "attach" ---@alias dap_config_request_custom "custom" diff --git a/lua/rustaceanvim/dap.lua b/lua/rustaceanvim/dap.lua index fcc1d728..cc64f3f3 100644 --- a/lua/rustaceanvim/dap.lua +++ b/lua/rustaceanvim/dap.lua @@ -178,8 +178,6 @@ local function format_environment_variable(adapter, key, segments, sep) return adapter.type == 'server' and { [key] = value } or { key .. '=' .. value } end ----@alias EnvironmentMap {[string]: string[]} - ---@type {[string]: EnvironmentMap} local environments = {}