feat(diagnostic): add diagnostic config (#1335)
Co-authored-by: gelocraft <gelocraft@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									db78c0b217
								
							
						
					
					
						commit
						76e06fec5c
					
				
							
								
								
									
										37
									
								
								init.lua
								
								
								
								
							
							
						
						
									
										37
									
								
								init.lua
								
								
								
								
							| 
						 | 
					@ -599,15 +599,34 @@ require('lazy').setup({
 | 
				
			||||||
        end,
 | 
					        end,
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      -- Change diagnostic symbols in the sign column (gutter)
 | 
					      -- Diagnostic Config
 | 
				
			||||||
      -- if vim.g.have_nerd_font then
 | 
					      -- See :help vim.diagnostic.Opts
 | 
				
			||||||
      --   local signs = { ERROR = '', WARN = '', INFO = '', HINT = '' }
 | 
					      vim.diagnostic.config {
 | 
				
			||||||
      --   local diagnostic_signs = {}
 | 
					        severity_sort = true,
 | 
				
			||||||
      --   for type, icon in pairs(signs) do
 | 
					        float = { border = 'rounded', source = 'if_many' },
 | 
				
			||||||
      --     diagnostic_signs[vim.diagnostic.severity[type]] = icon
 | 
					        underline = { severity = vim.diagnostic.severity.ERROR },
 | 
				
			||||||
      --   end
 | 
					        signs = vim.g.have_nerd_font and {
 | 
				
			||||||
      --   vim.diagnostic.config { signs = { text = diagnostic_signs } }
 | 
					          text = {
 | 
				
			||||||
      -- end
 | 
					            [vim.diagnostic.severity.ERROR] = ' ',
 | 
				
			||||||
 | 
					            [vim.diagnostic.severity.WARN] = ' ',
 | 
				
			||||||
 | 
					            [vim.diagnostic.severity.INFO] = ' ',
 | 
				
			||||||
 | 
					            [vim.diagnostic.severity.HINT] = ' ',
 | 
				
			||||||
 | 
					          },
 | 
				
			||||||
 | 
					        } or {},
 | 
				
			||||||
 | 
					        virtual_text = {
 | 
				
			||||||
 | 
					          source = 'if_many',
 | 
				
			||||||
 | 
					          spacing = 2,
 | 
				
			||||||
 | 
					          format = function(diagnostic)
 | 
				
			||||||
 | 
					            local diagnostic_message = {
 | 
				
			||||||
 | 
					              [vim.diagnostic.severity.ERROR] = diagnostic.message,
 | 
				
			||||||
 | 
					              [vim.diagnostic.severity.WARN] = diagnostic.message,
 | 
				
			||||||
 | 
					              [vim.diagnostic.severity.INFO] = diagnostic.message,
 | 
				
			||||||
 | 
					              [vim.diagnostic.severity.HINT] = diagnostic.message,
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            return diagnostic_message[diagnostic.severity]
 | 
				
			||||||
 | 
					          end,
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      -- LSP servers and clients are able to communicate to each other what features they support.
 | 
					      -- LSP servers and clients are able to communicate to each other what features they support.
 | 
				
			||||||
      --  By default, Neovim doesn't support everything that is in the LSP specification.
 | 
					      --  By default, Neovim doesn't support everything that is in the LSP specification.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue