Skip to content

Commit

Permalink
Update outdated launch.json docs
Browse files Browse the repository at this point in the history
Didn't reflect the changes made in #1237
  • Loading branch information
mfussenegger committed Dec 31, 2024
1 parent ffb077e commit 516d5bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 30 deletions.
34 changes: 4 additions & 30 deletions doc/dap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,12 @@ DEBUGEE CONFIGURATION via launch.json *dap-launch.json*

nvim-dap supports a subset of the `launch.json` file format used to configure
debug adapters in Visual Studio Code.

To load a `launch.json` file, use the `load_launchjs` function from the
`dap.ext.vscode` module.
`.vscode/launch.json` are read automatically whenever you start a new debug
session using |dap.continue()| or `:DapNew`. (via a configuration provider,
see |dap-providers-configs|)

Unlike VS Code, nvim-dap supports standard JSON. Trailing commas on the
last item of a list are an error.

If you install a 3rd-party json5 parser you can override the json decode
function to support json5 features like trailing comma.
>
Expand All @@ -341,23 +340,7 @@ function to support json5 features like trailing comma.
(One json5 parser implementation is https://github.com/Joakker/lua-json5)


load_launchjs({path}, {type_to_filetypes}) *dap.ext.vscode.load_launchjs*

Parses a JSON file at {path} and adds the entries to `dap.configurations`.
Configurations are overwritten by name, so if filetype and name matches a
configuration in `dap.configurations`, the config is overwritten by the
one loaded from the file at {path}.

Parameters:
{path} Path to the `launch.json` file. Defaults to
`.vscode/launch.json` in the current working directory.

{type_to_filetypes} A table mapping `type` values in `launch.json` to
one or more filetypes.
By default, the `type` values in `launch.json` will
be used as filetypes verbatim.

An example `launch.json` might look like this:
An example `launch.json` looks like this:

>json
{
Expand All @@ -377,15 +360,6 @@ An example `launch.json` might look like this:
}
<

For the above configuration, calling `load_launchjs` adds the first entry to
`dap.configurations.java` and the second entry to `dap.configurations.cppdbg`.
If you wanted to add the second entry to the `c` or `cpp` configurations you
could call `load_launchjs` like this instead:
>
>lua
require('dap.ext.vscode').load_launchjs(nil, { cppdbg = {'c', 'cpp'} })
<

load_launchjs supports `inputs`. Inputs can be used to define custom input prompts.
They are declared in an "inputs" array and each input must have the following properties:

Expand Down
1 change: 1 addition & 0 deletions lua/dap/ext/vscode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ end


--- Extends dap.configurations with entries read from .vscode/launch.json
---@deprecated
function M.load_launchjs(path, type_to_filetypes)
type_to_filetypes = vim.tbl_extend('keep', type_to_filetypes or {}, M.type_to_filetypes)
local configurations = M.getconfigs(path)
Expand Down

0 comments on commit 516d5bb

Please sign in to comment.