lspconfig - add snippet support, fix css
This commit is contained in:
parent
aaf41ab39e
commit
b3e1ce732b
|
@ -1,3 +1,15 @@
|
||||||
|
snippet pp "<?php ... ?>"
|
||||||
|
<?php $0; ?>
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet pe "<?php ... ?>"
|
||||||
|
<?php echo "$0"; ?>
|
||||||
|
endsnippet
|
||||||
|
|
||||||
|
snippet ph "<?php ... ?>"
|
||||||
|
<?php esc_html( $0 ); ?>
|
||||||
|
endsnippet
|
||||||
|
|
||||||
snippet pf "public function ..."
|
snippet pf "public function ..."
|
||||||
public function $1($2) {
|
public function $1($2) {
|
||||||
$0
|
$0
|
||||||
|
|
|
@ -58,7 +58,7 @@ Plug '~/nvim-paper-tonic'
|
||||||
Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' }
|
Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' }
|
||||||
Plug 'hrsh7th/cmp-buffer', { 'branch': 'main' }
|
Plug 'hrsh7th/cmp-buffer', { 'branch': 'main' }
|
||||||
Plug 'hrsh7th/cmp-path', { 'branch': 'main' }
|
Plug 'hrsh7th/cmp-path', { 'branch': 'main' }
|
||||||
" Plug 'hrsh7th/cmp-nvim-ultisnips'
|
Plug 'quangnguyen30192/cmp-nvim-ultisnips', { 'branch': 'main' }
|
||||||
|
|
||||||
"}}}
|
"}}}
|
||||||
|
|
||||||
|
|
|
@ -11,32 +11,6 @@ require'nvim-treesitter.configs'.setup {
|
||||||
additional_vim_regex_highlighting = false,
|
additional_vim_regex_highlighting = false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
-- https://github.com/neovim/nvim-lspconfig
|
|
||||||
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md
|
|
||||||
-- npm install -g typescript typescript-language-server
|
|
||||||
require'lspconfig'.tsserver.setup{}
|
|
||||||
-- npm install -g vim-language-server
|
|
||||||
require'lspconfig'.vimls.setup{}
|
|
||||||
-- npm install -g pyright
|
|
||||||
require'lspconfig'.pyright.setup{}
|
|
||||||
-- phpactor installation -
|
|
||||||
-- https://phpactor.readthedocs.io/en/master/usage/standalone.html
|
|
||||||
require'lspconfig'.phpactor.setup{}
|
|
||||||
-- npm i -g vscode-langservers-extracted
|
|
||||||
require'lspconfig'.intelephense.setup{}
|
|
||||||
-- npm install -g intelephense
|
|
||||||
require'lspconfig'.cssls.setup{}
|
|
||||||
-- npm install -g vls
|
|
||||||
require'lspconfig'.vuels.setup{}
|
|
||||||
-- npm i -g bash-language-server
|
|
||||||
-- TODO - don't run for sh files but have something else instead - shellcheck?
|
|
||||||
require'lspconfig'.bashls.setup{}
|
|
||||||
-- npm install -g yaml-language-server
|
|
||||||
require'lspconfig'.yamlls.setup{}
|
|
||||||
-- npm i -g stylelint-lsp
|
|
||||||
require'lspconfig'.stylelint_lsp.setup{}
|
|
||||||
-- https://github.com/neovim/nvim-lspconfig/wiki
|
|
||||||
require'lspconfig'.tailwindcss.setup{}
|
|
||||||
|
|
||||||
--[efm-langserver]
|
--[efm-langserver]
|
||||||
|
|
||||||
|
@ -110,8 +84,38 @@ require "lspconfig".efm.setup {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- [lspconfig]
|
||||||
|
|
||||||
local nvim_lsp = require('lspconfig')
|
local nvim_lsp = require('lspconfig')
|
||||||
|
|
||||||
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
|
-- map buffer local keybindings when the language server attaches
|
||||||
|
local servers = {
|
||||||
|
-- npm i -g bash-language-server
|
||||||
|
-- TODO - don't run for sh files but have something else instead - shellcheck?
|
||||||
|
'bashls',
|
||||||
|
-- npm i -g vscode-langservers-extracted
|
||||||
|
'cssls',
|
||||||
|
-- npm install -g intelephense
|
||||||
|
'intelephense',
|
||||||
|
-- https://phpactor.readthedocs.io/en/master/usage/standalone.html
|
||||||
|
'phpactor',
|
||||||
|
-- npm install -g pyright
|
||||||
|
'pyright',
|
||||||
|
-- npm i -g stylelint-lsp
|
||||||
|
'stylelint_lsp',
|
||||||
|
-- https://github.com/neovim/nvim-lspconfig/wiki
|
||||||
|
'tailwindcss',
|
||||||
|
-- npm install -g typescript typescript-language-server
|
||||||
|
'tsserver',
|
||||||
|
-- npm install -g vim-language-server
|
||||||
|
'vimls',
|
||||||
|
-- npm install -g vls
|
||||||
|
'vuels',
|
||||||
|
-- npm i -g stylelint-lsp
|
||||||
|
'yamlls',
|
||||||
|
}
|
||||||
|
|
||||||
-- Use an on_attach function to only map the following keys
|
-- Use an on_attach function to only map the following keys
|
||||||
-- after the language server attaches to the current buffer
|
-- after the language server attaches to the current buffer
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
|
@ -120,10 +124,8 @@ local on_attach = function(client, bufnr)
|
||||||
|
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
local opts = { noremap=true, silent=true }
|
local opts = { noremap=true, silent=true }
|
||||||
|
|
||||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||||
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
buf_set_keymap('n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||||
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
buf_set_keymap('n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||||
|
@ -142,26 +144,15 @@ local on_attach = function(client, bufnr)
|
||||||
-- buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
-- buf_set_keymap('n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||||
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
-- buf_set_keymap('n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||||
-- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
-- buf_set_keymap('n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
-- map buffer local keybindings when the language server attaches
|
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||||
local servers = {
|
|
||||||
'bashls',
|
|
||||||
'cssls',
|
|
||||||
'intelephense',
|
|
||||||
'phpactor',
|
|
||||||
'pyright',
|
|
||||||
'stylelint_lsp',
|
|
||||||
'tailwindcss',
|
|
||||||
'tsserver',
|
|
||||||
'vimls',
|
|
||||||
'vuels'
|
|
||||||
}
|
|
||||||
for _, lsp in ipairs(servers) do
|
for _, lsp in ipairs(servers) do
|
||||||
nvim_lsp[lsp].setup {
|
nvim_lsp[lsp].setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
flags = {
|
flags = {
|
||||||
debounce_text_changes = 150,
|
debounce_text_changes = 150,
|
||||||
}
|
}
|
||||||
|
@ -174,11 +165,11 @@ cmp.setup({
|
||||||
keyword_length = 4
|
keyword_length = 4
|
||||||
-- autocomplete = false
|
-- autocomplete = false
|
||||||
},
|
},
|
||||||
-- snippet = {
|
snippet = {
|
||||||
-- expand = function(args)
|
expand = function(args)
|
||||||
-- vim.fn["vsnip#anonymous"](args.body)
|
vim.fn["vsnip#anonymous"](args.body)
|
||||||
-- end,
|
end,
|
||||||
-- },
|
},
|
||||||
mapping = {
|
mapping = {
|
||||||
['<C-n>'] = cmp.mapping.complete(),
|
['<C-n>'] = cmp.mapping.complete(),
|
||||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||||
|
@ -188,7 +179,7 @@ cmp.setup({
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer' },
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp' },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
--{ name = 'ultisnips' },
|
{ name = 'ultisnips' },
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -174,3 +174,5 @@ erimplement
|
||||||
particularly
|
particularly
|
||||||
movie
|
movie
|
||||||
multivariable
|
multivariable
|
||||||
|
Unsetting
|
||||||
|
ajax
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue