Update cmp. Add sql, html and css lsp functionality. Add snippet for go error handling. Enable Treesitter for syntax highlighting
This commit is contained in:
parent
fe9da6af57
commit
966adc7817
@ -42,6 +42,7 @@ function settings.init()
|
||||
require('settings.lsp').init()
|
||||
require('settings.completion')
|
||||
require('settings.tree')
|
||||
require('settings.luasnip')
|
||||
end
|
||||
|
||||
return settings
|
||||
|
@ -23,7 +23,7 @@ function lsp.init()
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup()
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
lspconfig.sumneko_lua.setup {
|
||||
@ -60,6 +60,18 @@ function lsp.init()
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
}
|
||||
lspconfig.sqlls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.html.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
lspconfig.cssls.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = lsp_attach
|
||||
})
|
||||
end
|
||||
|
||||
return lsp
|
||||
|
3
lua/settings/luasnip.lua
Normal file
3
lua/settings/luasnip.lua
Normal file
@ -0,0 +1,3 @@
|
||||
local ls = require("luasnip")
|
||||
|
||||
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets/" })
|
@ -28,6 +28,12 @@ function theme.initColorscheme()
|
||||
vim.cmd 'colorscheme darcula-solid'
|
||||
vim.cmd 'set termguicolors'
|
||||
vim.opt.syntax = 'on'
|
||||
require('nvim-treesitter.configs').setup {
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
function theme.init()
|
||||
|
25
snippets/go.lua
Normal file
25
snippets/go.lua
Normal file
@ -0,0 +1,25 @@
|
||||
local ls = require("luasnip")
|
||||
local s = ls.s
|
||||
local i = ls.i
|
||||
local t = ls.t
|
||||
|
||||
local d = ls.dynamic_node
|
||||
local c = ls.choice_node
|
||||
local f = ls.function_node
|
||||
local sn = ls.snippet_node
|
||||
|
||||
local fmt = require("luasnip.extras.fmt").fmt
|
||||
local rep = require("luasnip.extras").rep
|
||||
|
||||
local snippets, autosnippets = {}, {}
|
||||
|
||||
local errorSnippet = s("error", fmt([[
|
||||
if err != nil {{
|
||||
{}
|
||||
}}
|
||||
]], {
|
||||
i(1, "return nil, err")
|
||||
}))
|
||||
table.insert(snippets, errorSnippet)
|
||||
|
||||
return snippets, autosnippets
|
Loading…
Reference in New Issue
Block a user