Skip to content

Commit

Permalink
fix(dap): bad config validation
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcjkb committed Feb 20, 2024
1 parent 1e0267e commit b0d5e49
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 7 additions & 1 deletion doc/rustaceanvim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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<string,string[]>


dap_config_request_launch *dap_config_request_launch*

Type: ~
Expand Down
2 changes: 1 addition & 1 deletion lua/rustaceanvim/config/check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
})
Expand Down
4 changes: 3 additions & 1 deletion lua/rustaceanvim/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string[]>

---@alias dap_config_request_launch "launch"
---@alias dap_config_request_attach "attach"
---@alias dap_config_request_custom "custom"
Expand Down
2 changes: 0 additions & 2 deletions lua/rustaceanvim/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}

Expand Down

0 comments on commit b0d5e49

Please sign in to comment.