Sanchayan Maity
9a26ef9c10
Use the new vim.lsp.start API and LspAttach/Detach auto commands. Drop nvim-lspconfig in the process. LSP server specific configuration has been taken from nvim-lspconfig.
35 lines
1.5 KiB
Lua
35 lines
1.5 KiB
Lua
local root_files = { 'jsconfig.json', 'tsconfig.json', 'package.json' }
|
|
local file_types = { 'javascript', 'javascriptreact', 'javascript.jsx', 'typescript', 'typescriptreact', 'typescript.tsx' }
|
|
local path = vim.fs.find(root_files, { type = "file" })
|
|
|
|
vim.lsp.start({
|
|
name = "tsserver",
|
|
cmd = { "typescript-language-server", "--stdio" },
|
|
root_dir = vim.fs.dirname(path[1]),
|
|
filetypes = file_types,
|
|
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,
|
|
}
|
|
}
|
|
}
|
|
})
|