nvim-lua / lsp_extensions.nvim

Repo to hold a bunch of info & extension callbacks for built-in LSP. Use at your own risk :wink:
MIT License
212 stars 18 forks source link

How do I configure colours for err, warn, hints etc #21

Open CallumDowling opened 3 years ago

CallumDowling commented 3 years ago

It is working find but, at them moment it is just normal text, but I would like to colour-code errs as red for example white_text

    1 call plug#begin('~/.vim/plugged')                                                                                                                                                                              
    2                                                                                                                                                                                                                
    3 " Collection of common configurations for the Nvim LSP client                                                                                                                                                  
    4 Plug 'neovim/nvim-lspconfig'                                                                                                                                                                                   
    5                                                                                                                                                                                                                
    6 " Extensions to built-in LSP, for example, providing type inlay hints                                                                                                                                          
    7 Plug 'tjdevries/lsp_extensions.nvim'                                                                                                                                                                           
    8                                                                                                                                                                                                                
    9 " Autocompletion framework for built-in LSP                                                                                                                                                                    
   10 Plug 'nvim-lua/completion-nvim'                                                                                                                                                                                
   11                                                                                                                                                                                                                
   12 Plug 'preservim/nerdtree'                                                                                                                                                                                      
   13                                                                                                                                                                                                                
   14 " Colours                                                                                                                                                                                                      
   15 Plug 'drewtempelmeyer/palenight.vim'                                                                                                                                                                           
   16 Plug 'arcticicestudio/nord-vim'                                                                                                                                                                                
   17 call plug#end()                                                                                                                                                                                                
   18                                                                                                                                                                                                                
   19                                                                                                                                                                                                                
   20 " Syntax highlighting and file type identification                                                                                                                                                             
   21 syntax enable                                                                                                                                                                                                  
   22 filetype plugin indent on                                                                                                                                                                                      
   23                                                                                                                                                                                                                
   24                                                                                                                                                                                                                
   25 " Set completeopt to have a better completion experience                                                                                                                                                       
   26 " :help completeopt                                                                                                                                                                                            
   27 " menuone: popup even when there's only one match                                                                                                                                                              
   28 " noinsert: Do not insert text until a selection is made                                                                                                                                                       
   29 " noselect: Do not select, force user to select one from the menu                                                                                                                                              
   30 set completeopt=menuone,noinsert,noselect                                                                                                                                                                      
   31                                                                                                                                                                                                                
   32 " Avoid showing extra messages when using completion                                                                                                                                                           
   33 set shortmess+=c                                                                                                                                                                                               
   34                                                                                                                                                                                                                
   35 " Configure LSP                                                                                                                                                                                                
   36 " https://github.com/neovim/nvim-lspconfig#rust_analyzer                                                                                                                                                       
   37 lua <<EOF                                                                                                                                                                                                      
   38                                                                                                                                                                                                                
   39 -- nvim_lsp object                                                                                                                                                                                             
   40 local nvim_lsp = require'lspconfig'                                                                                                                                                                            
   41                                                                                                                                                                                                                
   42 -- function to attach completion when setting up lsp                                                                                                                                                           
   43 local on_attach = function(client)                                                                                                                                                                             
   44     require'completion'.on_attach(client)                                                                                                                                                                      
   45 end                                                                                                                                                                                                            
   46                                                                                                                                                                                                                
   47 -- Enable rust_analyzer                                                                                                                                                                                        
   48 nvim_lsp.rust_analyzer.setup({ on_attach=on_attach })                                                                                                                                                          
   49                                                                                                                                                                                                                
   50 -- Enable diagnostics                                                                                                                                                                                          
   51 vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(                                                                                                                                            
   52   vim.lsp.diagnostic.on_publish_diagnostics, {                                                                                                                                                                 
   53     virtual_text = true,                                                                                                                                                                                       
   54     signs = true,                                                                                                                                                                                              
   55     update_in_insert = true,                                                                                                                                                                                   
   56   }                                                                                                                                                                                                            
   57 )                                                                                                                                                                                                              
   58 EOF  
jrmoulton commented 3 years ago

I saw that @jonhoo worked something out in his init.vim https://github.com/jonhoo/configs/blob/a19bc3b57a503815ba04eb7c32f9e064ae1c7687/editor/.config/nvim/init.vim#L69

but I am also wondering if there is a more straight forward/simpler way to configure the colors because I can't replicate what @jonhoo has