135 lines
3.5 KiB
Lua
135 lines
3.5 KiB
Lua
local lspconfig = require 'lspconfig'
|
|
|
|
-- local on_attach = function(client)
|
|
-- require 'completion'.on_attach(client)
|
|
-- end
|
|
|
|
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
|
|
-- BASH
|
|
lspconfig.bashls.setup({})
|
|
|
|
-- CLANG
|
|
lspconfig.clangd.setup({})
|
|
|
|
-- CMAKE
|
|
lspconfig.cmake.setup({})
|
|
|
|
-- LATEX
|
|
local path = vim.fn.stdpath("config") .. "/after/plugin/dictionary-gb.txt"
|
|
local words = {}
|
|
|
|
for word in io.open(path, "r"):lines() do
|
|
table.insert(words, word)
|
|
end
|
|
|
|
lspconfig.ltex.setup({
|
|
settings = {
|
|
ltex = {
|
|
language = "en-GB",
|
|
dictionary = {
|
|
["en-GB"] = words,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
-- LUA
|
|
lspconfig.lua_ls.setup {
|
|
on_init = function(client)
|
|
if client.workspace_folders then
|
|
local path = client.workspace_folders[1].name
|
|
if vim.loop.fs_stat(path..'/.luarc.json') or vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
|
return
|
|
end
|
|
end
|
|
|
|
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
|
runtime = {
|
|
-- Tell the language server which version of Lua you're using
|
|
-- (most likely LuaJIT in the case of Neovim)
|
|
version = 'LuaJIT'
|
|
},
|
|
-- Make the server aware of Neovim runtime files
|
|
workspace = {
|
|
checkThirdParty = false,
|
|
library = {
|
|
vim.env.VIMRUNTIME
|
|
-- Depending on the usage, you might want to add additional paths here.
|
|
-- "${3rd}/luv/library"
|
|
-- "${3rd}/busted/library",
|
|
},
|
|
-- or pull in all of 'runtimepath'. NOTE: this is a lot slower and will cause issues when working on your own configuration (see https://github.com/neovim/nvim-lspconfig/issues/3189)
|
|
-- library = vim.api.nvim_get_runtime_file("", true)
|
|
},
|
|
diagnostics = {
|
|
-- Get the language server to recognize the `vim` global
|
|
globals = { 'vim', 'require' },
|
|
},
|
|
format = {
|
|
-- Put format options here
|
|
-- NOTE: the value should be STRING!!
|
|
defaultConfig = {
|
|
indent_style = "space",
|
|
indent_size = "4",
|
|
}
|
|
},
|
|
})
|
|
end,
|
|
settings = {
|
|
Lua = {}
|
|
}
|
|
}
|
|
|
|
|
|
-- PYTHON
|
|
lspconfig.pylsp.setup {
|
|
settings = {
|
|
pylsp = {
|
|
plugins = {
|
|
-- formatter options
|
|
black = { enabled = true },
|
|
autopep8 = { enabled = false },
|
|
yapf = { enabled = false },
|
|
-- linter options
|
|
pylint = { enabled = false, executable = "pylint" },
|
|
pyflakes = { enabled = false },
|
|
pycodestyle = { enabled = true, maxLineLength = 110 },
|
|
-- type checker
|
|
pylsp_mypy = { enabled = true },
|
|
-- auto-completion options
|
|
jedi_completion = { fuzzy = true },
|
|
-- import sorting
|
|
pyls_isort = { enabled = true },
|
|
},
|
|
},
|
|
},
|
|
flags = {
|
|
debounce_text_changes = 200,
|
|
},
|
|
}
|
|
|
|
-- RUST
|
|
lspconfig.rust_analyzer.setup({
|
|
-- on_attach = on_attach,
|
|
capabilities = capabilities,
|
|
settings = {
|
|
["rust-analyzer"] = {
|
|
imports = {
|
|
granularity = {
|
|
group = "module",
|
|
},
|
|
prefix = "self",
|
|
},
|
|
cargo = {
|
|
buildScripts = {
|
|
enable = true,
|
|
},
|
|
},
|
|
procMacro = {
|
|
enable = true
|
|
},
|
|
}
|
|
}
|
|
})
|