Moved lsp configurations per language to ftplugins folder
This commit is contained in:
parent
6b6613aeea
commit
12b89714dc
3
lua/barink/after/ftplugin/asm.lua
Normal file
3
lua/barink/after/ftplugin/asm.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require('lspconfig')['asm_lsp'].setup({
|
||||
capabilities = capabilities
|
||||
})
|
3
lua/barink/after/ftplugin/bash.lua
Normal file
3
lua/barink/after/ftplugin/bash.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require('lspconfig')['bashls'].setup({
|
||||
capabilities = capabilities
|
||||
})
|
20
lua/barink/after/ftplugin/cpp.lua
Normal file
20
lua/barink/after/ftplugin/cpp.lua
Normal 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
|
||||
})
|
@ -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',
|
||||
|
@ -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
|
||||
})
|
||||
|
3
lua/barink/after/ftplugin/javascript.lua
Normal file
3
lua/barink/after/ftplugin/javascript.lua
Normal file
@ -0,0 +1,3 @@
|
||||
require('lspconfig')['tsserver'].setup({
|
||||
capabilities = capabilities
|
||||
})
|
@ -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' }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
6
lua/barink/after/ftplugin/python.lua
Normal file
6
lua/barink/after/ftplugin/python.lua
Normal file
@ -0,0 +1,6 @@
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
require('lspconfig')['pyright'].setup({
|
||||
capabilities = capabilities
|
||||
})
|
6
lua/barink/after/ftplugin/rust.lua
Normal file
6
lua/barink/after/ftplugin/rust.lua
Normal file
@ -0,0 +1,6 @@
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
require('lspconfig')['rust_analyzer'].setup({
|
||||
capabilities = capabilities
|
||||
})
|
6
lua/barink/after/ftplugin/zig.lua
Normal file
6
lua/barink/after/ftplugin/zig.lua
Normal file
@ -0,0 +1,6 @@
|
||||
-- Set up lspconfig.
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
|
||||
require('lspconfig')['zls'].setup({
|
||||
capabilities = capabilities
|
||||
})
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user