48 lines
1.4 KiB
Lua
48 lines
1.4 KiB
Lua
-- TypeScript/JavaScript LSP configuration
|
|
-- Uses typescript-language-server installed via Mason
|
|
|
|
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
|
|
vim.lsp.config("ts_ls", {
|
|
cmd = { "typescript-language-server", "--stdio" },
|
|
filetypes = {
|
|
"typescript",
|
|
"typescriptreact",
|
|
"typescript.tsx",
|
|
"javascript",
|
|
"javascriptreact",
|
|
"javascript.jsx",
|
|
},
|
|
capabilities = capabilities,
|
|
root_markers = { "package.json", "tsconfig.json", "jsconfig.json", ".git" },
|
|
settings = {
|
|
javascript = {
|
|
format = {
|
|
enable = true,
|
|
insertSpaceAfterCommaDelimiter = true,
|
|
insertSpaceAfterSemicolon = true,
|
|
insertSpaceBeforeAndAfterOperator = true,
|
|
indentStyle = "smart",
|
|
indentSize = 2,
|
|
},
|
|
suggest = {
|
|
completeFunctionCalls = true,
|
|
},
|
|
},
|
|
typescript = {
|
|
format = {
|
|
enable = true,
|
|
insertSpaceAfterCommaDelimiter = true,
|
|
insertSpaceAfterSemicolon = true,
|
|
insertSpaceBeforeAndAfterOperator = true,
|
|
indentStyle = "smart",
|
|
indentSize = 2,
|
|
},
|
|
suggest = {
|
|
completeFunctionCalls = true,
|
|
},
|
|
},
|
|
},
|
|
})
|
|
|
|
vim.lsp.enable("ts_ls")
|