diff options
Diffstat (limited to 'lua/lvim/lsp')
| -rw-r--r-- | lua/lvim/lsp/config.lua | 37 | ||||
| -rw-r--r-- | lua/lvim/lsp/handlers.lua | 45 | ||||
| -rw-r--r-- | lua/lvim/lsp/init.lua | 2 | 
3 files changed, 16 insertions, 68 deletions
| diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua index 42bebdca..568441d2 100644 --- a/lua/lvim/lsp/config.lua +++ b/lua/lvim/lsp/config.lua @@ -54,37 +54,10 @@ local join_paths = require("lvim.utils").join_paths  return {    templates_dir = join_paths(get_runtime_dir(), "site", "after", "ftplugin"), -  diagnostics = { -    signs = { -      active = true, -      values = { -        { name = "DiagnosticSignError", text = lvim.icons.diagnostics.Error }, -        { name = "DiagnosticSignWarn", text = lvim.icons.diagnostics.Warning }, -        { name = "DiagnosticSignHint", text = lvim.icons.diagnostics.Hint }, -        { name = "DiagnosticSignInfo", text = lvim.icons.diagnostics.Information }, -      }, -    }, -    virtual_text = true, -    update_in_insert = false, -    underline = true, -    severity_sort = true, -    float = { -      focusable = true, -      style = "minimal", -      border = "rounded", -      source = "always", -      header = "", -      prefix = "", -    }, -  }, +  ---@deprecated use vim.diagnostic.config() instead +  diagnostics = {},    document_highlight = false,    code_lens_refresh = true, -  ---@usage list of the keys to override behavior of the handlers -  handlers = { -    focusable = true, -    style = "minimal", -    border = "rounded", -  },    on_attach_callback = nil,    on_init_callback = nil,    automatic_configuration = { @@ -106,11 +79,9 @@ return {            local config = vim.tbl_get(vim.diagnostic.config(), "float")            if config then -            return +            config.scope = "line" +            vim.diagnostic.open_float(0, config)            end - -          config.scope = "line" -          vim.diagnostic.open_float(0, config)          end,          "Show line diagnostics",        }, diff --git a/lua/lvim/lsp/handlers.lua b/lua/lvim/lsp/handlers.lua index f26bca1f..4a8c8319 100644 --- a/lua/lvim/lsp/handlers.lua +++ b/lua/lvim/lsp/handlers.lua @@ -2,42 +2,17 @@  -- Note: You can set a prefix per lsp server in the lv-globals.lua file  local M = {} -local default_diagnostic_config = { -  signs = { -    active = true, -    values = { -      { name = "DiagnosticSignError", text = lvim.icons.diagnostics.Error }, -      { name = "DiagnosticSignWarn", text = lvim.icons.diagnostics.Warning }, -      { name = "DiagnosticSignHint", text = lvim.icons.diagnostics.Hint }, -      { name = "DiagnosticSignInfo", text = lvim.icons.diagnostics.Information }, -    }, -  }, -  virtual_text = true, -  update_in_insert = false, -  underline = true, -  severity_sort = true, -  float = { -    focusable = true, -    style = "minimal", -    border = "rounded", -    source = "always", -    header = "", -    prefix = "", -    format = function(d) -      local code = d.code or (d.user_data and d.user_data.lsp.code) -      if code then -        return string.format("%s [%s]", d.message, code):gsub("1. ", "") -      end -      return d.message -    end, -  }, -} +function M.setup() +  local config = { -- your config +    virtual_text = lvim.lsp.diagnostics.virtual_text, +    signs = lvim.lsp.diagnostics.signs, +    underline = lvim.lsp.diagnostics.underline, +    update_in_insert = lvim.lsp.diagnostics.update_in_insert, +    severity_sort = lvim.lsp.diagnostics.severity_sort, +    float = lvim.lsp.diagnostics.float, +  } -function M.load_defaults() -  vim.diagnostic.config(default_diagnostic_config) - -  vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, lvim.lsp.handlers) -  vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, lvim.lsp.handlers) +  vim.diagnostic.config(config)  end  return M diff --git a/lua/lvim/lsp/init.lua b/lua/lvim/lsp/init.lua index 62287b30..df63b39b 100644 --- a/lua/lvim/lsp/init.lua +++ b/lua/lvim/lsp/init.lua @@ -94,6 +94,8 @@ function M.setup()      return    end +  require("lvim.lsp.handlers").setup() +    if lvim.use_icons then      for _, sign in ipairs(vim.tbl_get(vim.diagnostic.config(), "signs", "values")) do        vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = sign.name }) | 
