Shatur / neovim-cmake

CMake integration for Neovim
GNU General Public License v3.0
87 stars 19 forks source link

"dap_open_command = nil" does not work #9

Closed spindensity closed 3 years ago

spindensity commented 3 years ago

Bug description

According to the documentation:

dap_open_command = require('dap').repl.open, -- Command to run after starting DAP session. You can set it to nil if you don't want to open anything or require('dapui').open if you are using https://github.com/rcarriga/nvim-dap-ui

But dap_open_command = nil does not work, it does not override the value of the dap_open_command key in the default configuration.

Steps to reproduce

Use the following configuration and execute :CMake debug:

require("cmake").setup({
    dap_open_command = nil,
})

Expected behavior

The plugin does not open DAP REPL automatically.

Actual behavior

The plugin opens DAP REPL automatically.

Additional information

The behavior of the following code is not consistent with the description of the documentation. When you set a key of a table to nil in lua, the actual effect is that the key is deleted from the table, so there is no dap_open_command key in values table at all with dap_open_command = nil, the overriding of the key would never happen.

https://github.com/Shatur/neovim-cmake/blob/797cc52cd6f70f31f230a05909daef86af6607cc/lua/cmake/init.lua#L7-L9

Shatur commented 3 years ago

When you set a key of a table to nil in lua, the actual effect is that the key is deleted from the table

Oh, didn't know about it. Could try to specify false? I'll update the documentation.

spindensity commented 3 years ago

Oh, didn't know about it. Could try to specify false? I'll update the documentation.

false is OK.

Shatur commented 3 years ago

Done, thank you!