summaryrefslogtreecommitdiff
path: root/lua/core/compe.lua
diff options
context:
space:
mode:
authorrebuilt <[email protected]>2021-08-16 18:46:36 +0200
committerGitHub <[email protected]>2021-08-16 19:46:36 +0300
commit8becb83eeba4c35c9d7fae90438f3d6ef60be790 (patch)
tree386cc3eb15509e5dadbbfc5546089aa7781e5482 /lua/core/compe.lua
parentae1dea8b6499afbc35d3386654f9d0d8d208d342 (diff)
Check if emmet is active. Enable emmet completion if emmet language server is active (#1335)
* Check if emmet is active. Enable emmet completion if it is active * move emmet check after the check for a space character * Check if emmet is active for the current buffer only
Diffstat (limited to 'lua/core/compe.lua')
-rw-r--r--lua/core/compe.lua14
1 files changed, 13 insertions, 1 deletions
diff --git a/lua/core/compe.lua b/lua/core/compe.lua
index b5b37805..9edb2af0 100644
--- a/lua/core/compe.lua
+++ b/lua/core/compe.lua
@@ -77,6 +77,17 @@ M.setup = function()
end
end
+ local is_emmet_active = function()
+ local clients = vim.lsp.buf_get_clients()
+
+ for _, client in pairs(clients) do
+ if client.name == "emmet_ls" then
+ return true
+ end
+ end
+ return false
+ end
+
-- Use (s-)tab to:
--- move to prev/next item in completion menuone
--- jump to prev/next snippet's placeholder
@@ -87,8 +98,9 @@ M.setup = function()
return t "<Plug>(vsnip-jump-next)"
elseif check_back_space() then
return t "<Tab>"
+ elseif is_emmet_active() then
+ return vim.fn["compe#complete"]()
else
- -- return vim.fn["compe#complete"]() -- < use this if you want <tab> to always offer completion
return t "<Tab>"
end
end