2024-12-20 09:26:37 +00:00
local lspconfig = require ' lspconfig '
2024-12-20 13:43:35 +00:00
-- local on_attach = function(client)
-- require 'completion'.on_attach(client)
-- end
local capabilities = require ( ' cmp_nvim_lsp ' ) . default_capabilities ( )
2024-12-20 09:26:37 +00:00
-- 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
2024-12-20 13:43:35 +00:00
lspconfig.ltex . setup ( {
2024-12-20 09:26:37 +00:00
settings = {
ltex = {
language = " en-GB " ,
dictionary = {
[ " en-GB " ] = words ,
} ,
} ,
} ,
} )
-- LUA
2024-12-20 13:43:35 +00:00
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",
2024-12-20 09:26:37 +00:00
} ,
2024-12-20 13:43:35 +00:00
-- 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 = { }
}
}
2024-12-20 09:26:37 +00:00
-- PYTHON
2024-12-20 13:43:35 +00:00
lspconfig.pylsp . setup {
2024-12-20 09:26:37 +00:00
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,
2024-12-20 13:43:35 +00:00
capabilities = capabilities ,
2024-12-20 09:26:37 +00:00
settings = {
[ " rust-analyzer " ] = {
imports = {
granularity = {
group = " module " ,
} ,
prefix = " self " ,
} ,
cargo = {
buildScripts = {
enable = true ,
} ,
} ,
procMacro = {
enable = true
} ,
}
}
} )