feat(lsp): enable single_file_mode
This commit is contained in:
parent
e9eba4ec91
commit
cbb5322563
2 changed files with 9 additions and 7 deletions
|
@ -55,4 +55,6 @@ end
|
||||||
|
|
||||||
M.autostart = true
|
M.autostart = true
|
||||||
|
|
||||||
|
M.single_file_mode = true
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
local cmp = require('cmp')
|
local cmp = require('cmp')
|
||||||
local utils = require('cosmic-ui.utils')
|
|
||||||
local cosmic_ui = require('cosmic-ui')
|
local cosmic_ui = require('cosmic-ui')
|
||||||
|
local utils = require('cosmic-ui.utils')
|
||||||
|
local luasnip = require('luasnip')
|
||||||
local config = require('cosmic.config')
|
local config = require('cosmic.config')
|
||||||
|
|
||||||
local has_words_before = function()
|
local has_words_before = function()
|
||||||
|
@ -28,11 +29,10 @@ local get_formatting = function()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
-- @TODO: support for vsnip, ultisnips
|
|
||||||
local default_cmp_opts = {
|
local default_cmp_opts = {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
require('luasnip').lsp_expand(args.body)
|
luasnip.lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
mapping = {
|
mapping = {
|
||||||
|
@ -51,8 +51,8 @@ local default_cmp_opts = {
|
||||||
['<Tab>'] = cmp.mapping(function(fallback)
|
['<Tab>'] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif require('luasnip').expand_or_jumpable() then
|
elseif luasnip.expand_or_jumpable() then
|
||||||
require('luasnip').expand_or_jump()
|
luasnip.expand_or_jump()
|
||||||
elseif has_words_before() then
|
elseif has_words_before() then
|
||||||
cmp.complete()
|
cmp.complete()
|
||||||
else
|
else
|
||||||
|
@ -65,8 +65,8 @@ local default_cmp_opts = {
|
||||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif require('luasnip').jumpable(-1) then
|
elseif luasnip.jumpable(-1) then
|
||||||
require('luasnip').jump(-1)
|
luasnip.jump(-1)
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue