mhartington / oceanic-next

Oceanic Next theme for neovim
Other
1.13k stars 141 forks source link

Support LspReferenceRead (and Write and Text) #120

Open aktau opened 1 year ago

aktau commented 1 year ago

This is not a bug report, hence I'm not following the template.

I'm a fan of this colorscheme and it is my daily driver. Neovim's builtin LSP has a nice feature where (if the LSP) supports it, Neovim can highlight other references to the variables/declaration/... under the cursor. It is generally configured in the LSP on attach method like this:

    if client.server_capabilities.documentHighlightProvider then
      aucmd("CursorHold", function() vim.lsp.buf.document_highlight() end)
      aucmd("CursorMoved", function() vim.lsp.buf.clear_references() end)
    end

I was wondering why this did nothing for me, despite my LSP supporting document highlighting. Then I found out mhartington/oceanic-next lacks the required highlight groups. Manually adding the following works:

hi! link LspReferenceRead Visual
hi! link LspReferenceText Visual
hi! link LspReferenceWrite Visual

This could be a nice default to just add to oceanic-next, so I can remove it from my config. I've been thinking about adding a curl/underline:

hi LspReferenceWrite cterm=undercurl gui=undercurl guibg=#3c3836

This works in my terminal, but I'm not sure how to go about verifying that the users' terminal supports this.

aktau commented 1 year ago

There are other doings similar add-ons to OceanicNext to me: https://github.com/rottencandy/dotfiles/blob/3ad97a7a1b6da32a005ccba3248e67cf16503384/config/nvim/nightly.vim#L546. Other variants support this too: https://github.com/adrian5/oceanic-next-vim.