mfussenegger / nvim-dap

Debug Adapter Protocol client implementation for Neovim
GNU General Public License v3.0
5.11k stars 179 forks source link

Way to update config before dap.continue #1087

Closed s1n7ax closed 1 month ago

s1n7ax commented 8 months ago

Problem Statement

Running a java applications requires set dap.configurations.java to be set. However this has to be resolved by communicating with the JDTLS.

resolve main classes -> resolve class paths for main classes -> create dap config

Configuration can be done LspAttach event but when updated the change will not reflect. So good option would be to configure it just before running.

Possible Solutions

Similar to dap.adapters, accept functions for dap.configurations

dap.configurations.java = function(on_config)
    -- generate the configuration
    on_config(java_dap_config)
end

Considered Alternatives

No response

mfussenegger commented 1 month ago

There are now configuration providers to do something like this.

See https://github.com/mfussenegger/nvim-dap/pull/1237 and for an example implementation https://github.com/mfussenegger/nvim-jdtls/pull/659/files