fix(diagnostics): show border around diagnostics
This commit is contained in:
parent
bd2f074d9c
commit
263b0d1b53
3 changed files with 26 additions and 22 deletions
|
@ -2,20 +2,22 @@ local icons = require('cosmic.core.theme.icons')
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.init()
|
function M.init()
|
||||||
if vim.diagnostic ~= nil then
|
vim.diagnostic.config({
|
||||||
vim.diagnostic.config({
|
underline = true,
|
||||||
underline = true,
|
update_in_insert = false,
|
||||||
update_in_insert = false,
|
virtual_text = {
|
||||||
virtual_text = {
|
spacing = 4,
|
||||||
spacing = 4,
|
source = 'always',
|
||||||
source = 'always',
|
-- severity = 'error'
|
||||||
-- severity = 'error'
|
-- prefix = '👾',
|
||||||
-- prefix = '👾',
|
},
|
||||||
},
|
signs = true,
|
||||||
signs = true,
|
severity_sort = true,
|
||||||
severity_sort = true,
|
float = {
|
||||||
})
|
show_header = true,
|
||||||
end
|
source = 'always',
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
local function do_diagnostic_signs()
|
local function do_diagnostic_signs()
|
||||||
local signs = {
|
local signs = {
|
||||||
|
|
|
@ -2,8 +2,6 @@ local map = require('cosmic.utils').map
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
local opts = { noremap = true, silent = true }
|
local opts = { noremap = true, silent = true }
|
||||||
local popup_opts = '{ border = "single", focusable = false, }'
|
|
||||||
local win_opts = '{ popup_opts = ' .. popup_opts .. '}'
|
|
||||||
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
map('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
|
@ -12,20 +10,24 @@ map('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||||
map('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
map('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||||
map('n', 'gr', '<cmd>lua require("telescope.builtin").lsp_references()<CR>', opts)
|
map('n', 'gr', '<cmd>lua require("telescope.builtin").lsp_references()<CR>', opts)
|
||||||
map('n', 'gn', '<cmd>lua require("cosmic.core.theme.ui").rename()<CR>', opts)
|
map('n', 'gn', '<cmd>lua require("cosmic.core.theme.ui").rename()<CR>', opts)
|
||||||
map('n', '[g', '<cmd>lua vim.lsp.diagnostic.goto_prev(' .. win_opts .. ')<CR>', opts)
|
|
||||||
map('n', ']g', '<cmd>lua vim.lsp.diagnostic.goto_next(' .. win_opts .. ')<CR>', opts)
|
-- diagnostics
|
||||||
map('n', 'ge', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics(' .. popup_opts .. ')<CR>', opts)
|
map('n', '[g', '<cmd>lua vim.diagnostic.goto_prev({ float = { border = "single" }})<CR>', opts)
|
||||||
|
map('n', ']g', '<cmd>lua vim.diagnostic.goto_next({ float = { border = "single" }})<CR>', opts)
|
||||||
|
map('n', 'ge', '<cmd>lua vim.diagnostic.open_float(0, { scope = "line", border = "single" })<CR>', opts)
|
||||||
|
map('n', '<space>ge', ':Telescope lsp_document_diagnostics', opts)
|
||||||
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
map('n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||||
map('n', '<space>ga', '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>', opts)
|
map('n', '<space>ga', '<cmd>lua require("telescope.builtin").lsp_code_actions()<CR>', opts)
|
||||||
map('v', '<space>ga', '<cmd>lua require("telescope.builtin").lsp_range_code_actions()<CR>', opts)
|
map('v', '<space>ga', '<cmd>lua require("telescope.builtin").lsp_range_code_actions()<CR>', opts)
|
||||||
map('n', '<space>gf', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
map('n', '<space>gf', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||||
map('n', '<C-k>', '<cmd>lua require("lsp_signature").signature()<CR>', opts)
|
map('n', '<C-k>', '<cmd>lua require("lsp_signature").signature()<CR>', opts)
|
||||||
|
|
||||||
|
-- lsp workspace
|
||||||
map('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
map('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||||
map('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
map('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
map('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
map('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||||
|
|
||||||
-- no default maps, so you may want to define some here
|
-- typescript helpers
|
||||||
map('n', '<space>gr', ':TSLspRenameFile<CR>', opts)
|
map('n', '<space>gr', ':TSLspRenameFile<CR>', opts)
|
||||||
map('n', '<space>go', ':TSLspOrganize<CR>', opts)
|
map('n', '<space>go', ':TSLspOrganize<CR>', opts)
|
||||||
map('n', '<space>gi', ':TSLspImportAll<CR>', opts)
|
map('n', '<space>gi', ':TSLspImportAll<CR>', opts)
|
||||||
|
|
|
@ -35,7 +35,7 @@ _While CosmicNvim is geared specifically toward TypeScript/JavaScript developmen
|
||||||
|
|
||||||
### Quick guide
|
### Quick guide
|
||||||
|
|
||||||
_Install script coming soon..._
|
_Requires Neovim (+0.6.0)_
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cd ~/.config
|
$ cd ~/.config
|
||||||
|
@ -49,7 +49,7 @@ You will need to set up Packers compiled file via the steps below:
|
||||||
3. Restart NVIM
|
3. Restart NVIM
|
||||||
4. Install LSP servers, `:LspInstallInfo` or `:LspInstall tsserver`
|
4. Install LSP servers, `:LspInstallInfo` or `:LspInstall tsserver`
|
||||||
|
|
||||||
For addtional installation details, please refer to the [wiki page](https://github.com/mattleong/CosmicNvim/wiki/Installation).
|
For additional installation details, please refer to the [wiki page](https://github.com/mattleong/CosmicNvim/wiki/Installation).
|
||||||
|
|
||||||
## Mappings
|
## Mappings
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue