1
0

Moved lsp configurations per language to ftplugins folder

This commit is contained in:
Nigel Barink 2024-09-23 10:38:23 +02:00
parent 6b6613aeea
commit 12b89714dc
Signed by: Nigel
GPG Key ID: 358D4144AFCABCBC
11 changed files with 72 additions and 61 deletions

View File

@ -0,0 +1,3 @@
require('lspconfig')['asm_lsp'].setup({
capabilities = capabilities
})

View File

@ -0,0 +1,3 @@
require('lspconfig')['bashls'].setup({
capabilities = capabilities
})

View File

@ -0,0 +1,20 @@
local root_files = {
'premake5.lua',
'.clang-tidy',
'.clang-format',
'compile_commands',
'compile_commands.json',
'compile_flags.txt',
'configure.ac',
'.git'
}
local util = require('lspconfig.util')
require('lspconfig')['clangd'].setup({
capabilities = capabilities,
filetypes= { 'c', 'cpp', 'objc', 'objcpp', 'cuda', 'proto' },
cmd = { 'clangd' },
single_file_support = true,
root_dir = function (fname)
return util.root_pattern(unpack(root_files))(fname)
end
})

View File

@ -1,5 +1,8 @@
require('lspconfig')['gopls'].setup({
capabilities = capabilities
})
local dap = require("dap")
print("You opened a Golang file")
dap.adapters.delve = {
type = 'server',

View File

@ -12,3 +12,9 @@ local config = {
require('jdtls').start_or_attach(config)
require('jdtls').setup_dap({hotcodreplace='auto'})
require('jdtls.dap').setup_dap_main_class_configs()
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')['jdtls'].setup({
capabilities = capabilities
})

View File

@ -0,0 +1,3 @@
require('lspconfig')['tsserver'].setup({
capabilities = capabilities
})

View File

@ -1 +1,14 @@
print("You opened a LUA file..")
local lsp = require("lspconfig")
lsp.lua_ls.setup({
capabilities = require('cmp_nvim_lsp').default_capabilities(),
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
})

View File

@ -0,0 +1,6 @@
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')['pyright'].setup({
capabilities = capabilities
})

View File

@ -0,0 +1,6 @@
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')['rust_analyzer'].setup({
capabilities = capabilities
})

View File

@ -0,0 +1,6 @@
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')['zls'].setup({
capabilities = capabilities
})

View File

@ -40,9 +40,9 @@ return
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
}),
sources = cmp.config.sources({
{ name = 'path' },
{ name = 'nvim_lsp', keyword_length = 1 },
{ name = 'luasnip', option = { show_autosnippets = true}},
{ name = 'path' },
}, {
{ name = 'buffer', keyword_length = 2 },
}),
@ -80,17 +80,6 @@ return
matching = { disallow_symbol_nonprefix_matching = false }
})
local lsp = require("lspconfig")
lsp.lua_ls.setup({
capabilities = require('cmp_nvim_lsp').default_capabilities(),
settings = {
Lua = {
diagnostics = {
globals = { 'vim' }
}
}
}
})
local ls = require("luasnip")
ls.config.set_config({
history = true,
@ -112,53 +101,6 @@ return
-- Set up lspconfig.
local capabilities = require('cmp_nvim_lsp').default_capabilities()
require('lspconfig')['asm_lsp'].setup({
capabilities = capabilities
})
local root_files = {
'premake5.lua',
'.clang-tidy',
'.clang-format',
'compile_commands',
'compile_commands.json',
'compile_flags.txt',
'configure.ac',
'.git'
}
local util = require('lspconfig.util')
require('lspconfig')['clangd'].setup({
capabilities = capabilities,
filetypes= { 'c', 'cpp', 'objc', 'objcpp', 'cuda', 'proto' },
cmd = { 'clangd' },
single_file_support = true,
root_dir = function (fname)
return util.root_pattern(unpack(root_files))(fname)
end
})
require('lspconfig')['zls'].setup({
capabilities = capabilities
})
require('lspconfig')['rust_analyzer'].setup({
capabilities = capabilities
})
require('lspconfig')['jdtls'].setup({
capabilities = capabilities
})
require('lspconfig')['bashls'].setup({
capabilities = capabilities
})
require('lspconfig')['gopls'].setup({
capabilities = capabilities
})
require('lspconfig')['tsserver'].setup({
capabilities = capabilities
})
end
}