Skip to content

Commit

Permalink
feat(native_lsp): add ability to disable background for inlay hints (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
mrtnvgr committed Jun 24, 2023
1 parent 6ecc158 commit b032ced
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ coc_nvim = true,
In the inners tables you can set the style for the diagnostics, both `virtual_text` (what you see on the side) and `underlines` (what points directly at the thing (e.g. an error)).

```
```lua
native_lsp = {
enabled = true,
virtual_text = {
Expand All @@ -424,6 +424,9 @@ native_lsp = {
warnings = { "underline" },
information = { "underline" },
},
inlay_hints = {
background = true,
},
},
```

Expand Down Expand Up @@ -931,6 +934,9 @@ native_lsp = {
warnings = { "underline" },
information = { "underline" },
},
inlay_hints = {
background = true,
},
},
```

Expand Down
8 changes: 7 additions & 1 deletion doc/catppuccin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ In the inners tables you can set the style for the diagnostics, both
`virtual_text` (what you see on the side) and `underlines` (what points
directly at the thing (e.g. an error)).

>
>lua
native_lsp = {
enabled = true,
virtual_text = {
Expand All @@ -354,6 +354,9 @@ directly at the thing (e.g. an error)).
warnings = { "underline" },
information = { "underline" },
},
inlay_hints = {
background = true,
},
},
<

Expand Down Expand Up @@ -630,6 +633,9 @@ nvim-lspconfig>lua
warnings = { "underline" },
information = { "underline" },
},
inlay_hints = {
background = true,
},
},
<

Expand Down
4 changes: 3 additions & 1 deletion lua/catppuccin/groups/integrations/native_lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local M = {}
function M.get()
local virtual_text = O.integrations.native_lsp.virtual_text
local underlines = O.integrations.native_lsp.underlines
local inlay_hints = O.integrations.native_lsp.inlay_hints

local error = C.red
local warning = C.yellow
Expand Down Expand Up @@ -88,7 +89,8 @@ function M.get()
-- fg of `Comment`
fg = C.overlay0,
-- bg of `CursorLine`
bg = O.transparent_background and C.none
bg = O.transparent_background
or not inlay_hints.background and C.none
or U.vary_color({ latte = U.lighten(C.mantle, 0.70, C.base) }, U.darken(C.surface0, 0.64, C.base)),
}, -- virtual text of the inlay hints
LspInfoBorder = { link = "FloatBorder" }, -- LspInfo border
Expand Down
3 changes: 3 additions & 0 deletions lua/catppuccin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ local M = {
warnings = { "underline" },
information = { "underline" },
},
inlay_hints = {
background = true,
},
},
navic = {
enabled = false,
Expand Down
4 changes: 4 additions & 0 deletions lua/catppuccin/types.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
---@field warnings CtpHighlightArgs[] Change the style of LSP warnings.
---@field information CtpHighlightArgs[] Change the style of LSP information.

---@class CtpNativeLspInlayHints
---@field background boolean Toggle the background of inlay hints.

---@class CtpIntegrations
---@field alpha boolean
---@field barbecue CtpIntegrationBarbecue
Expand Down Expand Up @@ -81,6 +84,7 @@
---@field enabled boolean? Whether to enable the Native LSP integration.
---@field virtual_text CtpNativeLspStyles? Styles to apply to virtual text.
---@field underlines CtpNativeLspStyles? Styles to apply to underlines.
---@field inlay_hints CtpNativeLspInlayHints? Inlay hints options.

---@class CtpIntegrationNavic
---@field enabled boolean? Whether to enable the navic integration.
Expand Down
4 changes: 4 additions & 0 deletions vim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ globals:
type: string
property: read-only

O.integrations.native_lsp.inlay_hints.background:
type: bool
property: read-only

O.integrations.navic:
type: table
property: full-write
Expand Down

0 comments on commit b032ced

Please sign in to comment.