Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(dap): split dap and dap_ui integrations #624

Merged
merged 11 commits into from
Dec 8, 2023
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,22 +938,16 @@ cmp = true
<!-- nvim-dap -->
</tr>
<tr>
<td> <a href="https://github.com/mfussenegger/nvim-dap">nvim-dap</a> & <a href="https://github.com/rcarriga/nvim-dap-ui">nvim-dap-ui</a> </td>
<td> <a href="https://github.com/mfussenegger/nvim-dap">nvim-dap</a> </td>
<td>

```lua
dap = {
enabled = true,
enable_ui = true, -- enable nvim-dap-ui
}
dap = true
```

<details> <summary>Special</a> </summary>

```lua
-- You NEED to override nvim-dap's default highlight groups, AFTER requiring nvim-dap
require("dap")

local sign = vim.fn.sign_define

sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
Expand All @@ -967,6 +961,20 @@ sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl =
</tr>
<!-- nvim-dap -->

<!-- nvim-dap-ui -->
</tr>
<tr>
<td> <a href="https://github.com/rcarriga/nvim-dap-ui">nvim-dap-ui</a> </td>
<td>

```lua
dap_ui = true
```

</td>
</tr>
<!-- nvim-dap-ui -->

<!-- nvim-lspconfig -->
</tr>
<tr>
Expand Down
14 changes: 6 additions & 8 deletions doc/catppuccin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -617,26 +617,24 @@ nvim-cmp>lua
cmp = true
<

nvim-dap & nvim-dap-ui>lua
dap = {
enabled = true,
enable_ui = true, -- enable nvim-dap-ui
}
nvim-dap>lua
dap = true
<

Special ~

>lua
-- You NEED to override nvim-dap's default highlight groups, AFTER requiring nvim-dap
require("dap")

local sign = vim.fn.sign_define

sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
<

nvim-dap-ui>lua
dap_ui = true
<

nvim-lspconfig>lua
native_lsp = {
enabled = true,
Expand Down
33 changes: 1 addition & 32 deletions lua/catppuccin/groups/integrations/dap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,11 @@ local M = {}

function M.get()
return {
-- nvim-dap
DapBreakpoint = { fg = C.red },
DapBreakpointCondition = { fg = C.yellow },
DapBreakpointRejected = { fg = C.mauve },
DapLogPoint = { fg = C.sky },
DapStopped = { fg = C.maroon },

-- nvim-dap-ui
DAPUIScope = { fg = C.sky },
DAPUIType = { fg = C.mauve },
DAPUIValue = { fg = C.sky },
DAPUIVariable = { fg = C.text },
DapUIModifiedValue = { fg = C.peach },
DapUIDecoration = { fg = C.sky },
DapUIThread = { fg = C.green },
DapUIStoppedThread = { fg = C.sky },
DapUISource = { fg = C.lavender },
DapUILineNumber = { fg = C.sky },
DapUIFloatBorder = { fg = C.sky },

DapUIWatchesEmpty = { fg = C.maroon },
DapUIWatchesValue = { fg = C.green },
DapUIWatchesError = { fg = C.maroon },

DapUIBreakpointsPath = { fg = C.sky },
DapUIBreakpointsInfo = { fg = C.green },
DapUIBreakpointsCurrentLine = { fg = C.green, style = { "bold" } },
DapUIBreakpointsDisabledLine = { fg = C.surface2 },

DapUIStepOver = { fg = C.blue },
DapUIStepInto = { fg = C.blue },
DapUIStepBack = { fg = C.blue },
DapUIStepOut = { fg = C.blue },
DapUIStop = { fg = C.red },
DapUIPlayPause = { fg = C.green },
DapUIRestart = { fg = C.green },
DapUIUnavailable = { fg = C.surface1 },
}
end

Expand Down
39 changes: 39 additions & 0 deletions lua/catppuccin/groups/integrations/dap_ui.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
local M = {}

function M.get()
return {
DapUIScope = { fg = C.sky },
DapUIType = { fg = C.mauve },
DapUIValue = { fg = C.sky },
DapUIVariable = { fg = C.text },
DapUIModifiedValue = { fg = C.peach },
DapUIDecoration = { fg = C.sky },
DapUIThread = { fg = C.green },
DapUIStoppedThread = { fg = C.sky },
DapUISource = { fg = C.lavender },
DapUILineNumber = { fg = C.sky },
DapUIFloatBorder = { fg = C.sky },

DapUIWatchesEmpty = { fg = C.maroon },
DapUIWatchesValue = { fg = C.green },
DapUIWatchesError = { fg = C.maroon },

DapUIBreakpointsPath = { fg = C.sky },
DapUIBreakpointsInfo = { fg = C.green },
DapUIBreakpointsCurrentLine = { fg = C.green, style = { "bold" } },
DapUIBreakpointsDisabledLine = { fg = C.surface2 },

DapUIStepOver = { fg = C.blue },
DapUIStepInto = { fg = C.blue },
DapUIStepBack = { fg = C.blue },
DapUIStepOut = { fg = C.blue },
DapUIStop = { fg = C.red },
DapUIPlayPause = { fg = C.green },
DapUIRestart = { fg = C.green },
DapUIUnavailable = { fg = C.surface1 },

DapUIWinSelect = { fg = C.peach },
}
end

return M
7 changes: 7 additions & 0 deletions lua/catppuccin/lib/mapper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ function M.apply(flavour)
theme.editor = require("catppuccin.groups.editor").get()
local final_integrations = {}

-- https://github.com/catppuccin/nvim/pull/624
if type(O.integrations.dap) == "table" and O.integrations.dap.enable_ui ~= nil then
O.integrations.dap_ui = O.integrations.dap.enable_ui
O.integrations.dap.enable_ui = nil
end

for integration in pairs(O.integrations) do
local cot = false
if type(O.integrations[integration]) == "table" then
Expand All @@ -46,6 +52,7 @@ function M.apply(flavour)
)
end
end

theme.integrations = final_integrations -- plugins
theme.terminal = require("catppuccin.groups.terminal").get() -- terminal colors
local user_highlights = O.highlight_overrides
Expand Down
12 changes: 2 additions & 10 deletions lua/catppuccin/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,15 @@
-- `coc.nvim` links to `native_lsp` highlight groups, so you can use
-- `native_lsp.virtual_text` and `native_lsp.underlines` to style diagnostics.
---@field coc_nvim boolean?
-- You **NEED** to override nvim-dap's default highlight groups, **AFTER** requiring nvim-dap:
--
-- ```lua
-- require("dap")
--
-- local sign = vim.fn.sign_define
--
-- sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint", linehl = "", numhl = ""})
-- sign("DapBreakpointCondition", { text = "●", texthl = "DapBreakpointCondition", linehl = "", numhl = ""})
-- sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint", linehl = "", numhl = ""})
-- ```
---@field dap CtpIntegrationDAP | boolean?
---@field dap boolean?
---@field dap_ui boolean?
---@field dashboard boolean?
---@field dropbar CtpIntegrationDropbar | boolean?
---@field fern boolean?
Expand Down Expand Up @@ -209,11 +206,6 @@
-- Whether the directory name should be dimmed.
---@field dim_dirname boolean?

---@class CtpIntegrationDAP
---@field enabled boolean
-- Enable `nvim-dap-ui`
---@field enable_ui boolean?

---@class CtpIntegrationDropbar
-- Whether to enable the dropbar integration.
---@field enabled boolean
Expand Down