nvim/lua/cosmic/lsp/providers/defaults.lua
2022-05-27 13:00:18 -07:00

34 lines
791 B
Lua

local M = {}
function M.on_attach(client, bufnr)
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
-- Enable completion triggered by <c-x><c-o>
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
require('cosmic.lsp.mappings').init(client, bufnr)
end
M.flags = {
debounce_text_changes = 150,
}
M.capabilities = {}
M.root_dir = function(fname)
local util = require('lspconfig').util
return util.root_pattern('.git')(fname)
or util.root_pattern('tsconfig.base.json')(fname)
or util.root_pattern('package.json')(fname)
or util.root_pattern('.eslintrc.js')(fname)
or util.root_pattern('.eslintrc.json')(fname)
or util.root_pattern('tsconfig.json')(fname)
end
M.autostart = true
M.single_file_support = true
return M