39 lines
1.4 KiB
Lua
39 lines
1.4 KiB
Lua
-- Get LSP capabilities with cmp support
|
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
|
local ok, cmp_nvim_lsp = pcall(require, 'cmp_nvim_lsp')
|
|
if ok then
|
|
capabilities = vim.tbl_deep_extend('force', capabilities, cmp_nvim_lsp.default_capabilities())
|
|
end
|
|
|
|
return {
|
|
name = 'ts_ls',
|
|
cmd = { 'typescript-language-server', '--stdio' },
|
|
root_dir = vim.fs.dirname(vim.fs.find({ 'package.json', 'tsconfig.json', 'jsconfig.json', '.git' }, { upward = true })[1]),
|
|
filetypes = { 'ts' },
|
|
capabilities = capabilities,
|
|
settings = {
|
|
typescript = {
|
|
inlayHints = {
|
|
includeInlayParameterNameHints = 'all',
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
|
includeInlayFunctionParameterTypeHints = true,
|
|
includeInlayVariableTypeHints = true,
|
|
includeInlayPropertyDeclarationTypeHints = true,
|
|
includeInlayFunctionLikeReturnTypeHints = true,
|
|
includeInlayEnumMemberValueHints = true,
|
|
},
|
|
},
|
|
javascript = {
|
|
inlayHints = {
|
|
includeInlayParameterNameHints = 'all',
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
|
includeInlayFunctionParameterTypeHints = true,
|
|
includeInlayVariableTypeHints = true,
|
|
includeInlayPropertyDeclarationTypeHints = true,
|
|
includeInlayFunctionLikeReturnTypeHints = true,
|
|
includeInlayEnumMemberValueHints = true,
|
|
},
|
|
},
|
|
},
|
|
}
|