summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/setup/lspconfig.lua
blob: 2c894fe908af318c3451a3a0cb156e859e016769 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
-- require("nvim-lsp-installer").setup {}
local lspconfig = require("lspconfig")

local function on_attach()
    vim.cmd("doautocmd User lspAttached")

    -- vim.cmd([[
    -- augroup Format
    --     au! * <buffer>
    --     au BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
    -- augroup END
    -- ]])
end

lspconfig.lua_ls.setup {
    on_attach = on_attach,
    settings = {
        Lua = {
            diagnostics = {
                globals = { 'vim' }
            }
        }
    }
}

-- lspconfig.hls.setup {
--     on_attach = on_attach,
--     filetypes = { 'haskell', 'lhaskell', 'cabal' },
-- }

lspconfig.bashls.setup {
    on_attach = on_attach,
}

-- lspconfig.omnisharp.setup {
--     cmd = { "/usr/bin/omnisharp", "--languageserver" , "--hostPID", tostring(vim.fn.getpid()) },
--     on_attach = on_attach,
--     -- use_mono = true,
-- }

local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
for type, icon in pairs(signs) do
    local hl = "DiagnosticSign" .. type
    vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
end