rafaeldelboni / cajus-nvim

Basic config to transform your NVIM in a powerful Clojure IDE using fennel, clojure-lsp and conjure.
The Unlicense
163 stars 21 forks source link

fix: Restore lsp sign default colors #3

Closed vloth closed 2 years ago

vloth commented 2 years ago

I noticed the lsp signs weren't being coloured. This changeset should restore their default color, that's how it looks in my setup now: image

rafaeldelboni commented 2 years ago

Hey @vloth thanks for your contrib, but this looks like something that only works on 0.5.1 and previous versions Reading the docs I checked that this symbols are now named as DiagnosticSign(something) like:

(vim.fn.sign_define "DiagnosticSignError" {:text "" :texthl "DiagnosticSignError"})
(vim.fn.sign_define "DiagnosticSignWarn" {:text "" :texthl "DiagnosticSignWarn"})
(vim.fn.sign_define "DiagnosticSignInfo" {:text "" :texthl "DiagnosticSignInfo"})
(vim.fn.sign_define "DiagnosticSignHint" {:text "" :texthl "DiagnosticSignHint"})

Could you test if this works on 0.5.1?

vloth commented 2 years ago

Hi, yes! I just tested here, but it doesn't work unfortunately

image

I could update the PR to include both versions or branch based on user's version. Any thoughts?

rafaeldelboni commented 2 years ago

The idea of version handling looks good, but I have no idea how to do

vloth commented 2 years ago

I played a little bit with the api and came up with the following:

(defn define-signs
  [prefix]
  (let [error (.. prefix "SignError")
        warn  (.. prefix "SignWarn")
        info  (.. prefix "SignInfo")
        hint  (.. prefix "SignHint")]
  (vim.fn.sign_define error {:text "x" :texthl error})
  (vim.fn.sign_define warn  {:text "!" :texthl warn})
  (vim.fn.sign_define info  {:text "i" :texthl info})
  (vim.fn.sign_define hint  {:text "?" :texthl hint})))

(if (= (nvim.fn.has "nvim-0.6") 1)
  (define-signs "Diagnostic")
  (define-signs "LspDiagnostics"))

Probably not the most elegant solution, but seems to get the job done. What do you think?

rafaeldelboni commented 2 years ago

LGTM! :smile:

vloth commented 2 years ago

Hi, I've pushed the commit with the change mentioned above. Could you see if it works on v0.6 too?

rafaeldelboni commented 2 years ago

Works great! Thanks for your contribution!!