From 543dead590a949255fbbada9e1775c31ad654682 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Wed, 15 May 2024 21:39:28 +0800 Subject: [PATCH] fix(dap): load vscode launch files with jsonc parser (#1839) This seems to be the proper fix for #1503. jsonc ensures compatibility with native vscode. Ref: https://github.com/mfussenegger/nvim-dap/issues/964 --- lua/lazyvim/plugins/extras/dap/core.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/dap/core.lua b/lua/lazyvim/plugins/extras/dap/core.lua index 7e370629..bf57ebc3 100644 --- a/lua/lazyvim/plugins/extras/dap/core.lua +++ b/lua/lazyvim/plugins/extras/dap/core.lua @@ -26,8 +26,6 @@ return { }, opts = {}, config = function(_, opts) - -- setup dap config by VsCode launch.json file - -- require("dap.ext.vscode").load_launchjs() local dap = require("dap") local dapui = require("dapui") dapui.setup(opts) @@ -81,6 +79,11 @@ return { }, }, }, + + -- VsCode launch.json parser + { + "folke/neoconf.nvim", + }, }, -- stylua: ignore @@ -115,5 +118,10 @@ return { { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] } ) end + + -- setup dap config by VsCode launch.json file + local vscode = require("dap.ext.vscode") + vscode.json_decode = require("neoconf.json.jsonc").decode_jsonc + vscode.load_launchjs() end, }