all repos

init.lua @ b70b5acb384aa6aec1894a18d76e9e85ee3b6928

my nvim config

init.lua/lua/fk/lsp/init.lua(view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
local on_attach = require "fk.lsp.attach"
local diagnostic = require "fk.lsp.diagnostic"
local M = {}

function M.setup()
  -- Diagnostics
  vim.diagnostic.config(diagnostic)
  for _, sign in ipairs(diagnostic.signs.active) do
    vim.fn.sign_define(sign.name, { texthl = sign.name, text = sign.text, numhl = "" })
  end

  require("nvim-lsp-installer").on_server_ready(function(server)
    require "fk.lsp.null" -- null-ls setup
    local opts = {
      on_attach = on_attach,
      capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()),
      flags = { debounce_text_changes = 150 },
    }

    -- setup server config if it exists
    require("lua-dev").setup()
    local ok, server_opts = pcall(require, "fk.lsp.providers." .. server.name)
    if ok then
      opts = vim.tbl_deep_extend("force", opts, server_opts or {})
    end

    server:setup(opts)

    vim.cmd [[ do User LspAttachBuffers ]]
  end)
end

return M