Something went wrong. Try again.
My neovim config
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192local M = {}
local typescript_filetypes = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx",}
local function find_root(bufnr, markers) local filename = vim.api.nvim_buf_get_name(bufnr) local path = filename ~= "" and vim.fs.dirname(filename) or vim.uv.cwd() local marker = vim.fs.find(markers, { path = path, upward = true })[1] return marker and vim.fs.dirname(marker) or nilend
local function deno_root(bufnr) return find_root(bufnr, { "deno.json", "deno.jsonc" })end
local function node_root(bufnr) -- A Deno project wins even when it also contains a package.json. if deno_root(bufnr) then return nil end return find_root(bufnr, { "package.json", "bun.lock", "bun.lockb", "bunfig.toml", "tsconfig.json", "jsconfig.json", })end
local function disable_formatting(client) -- Conform owns JS/TS formatting (oxfmt/prettier). client.server_capabilities.documentFormattingProvider = false client.server_capabilities.documentRangeFormattingProvider = falseend
M.vtsls = { filetypes = typescript_filetypes, root_dir = function(bufnr, on_dir) local root = node_root(bufnr) if root then on_dir(root) end end, on_attach = disable_formatting, settings = { vtsls = { autoUseWorkspaceTsdk = true, }, typescript = { inlayHints = { enable = true, includeInlayParameterNameHints = "all", includeInlayParameterNameHintsWhenArgumentMatchesName = false, includeInlayFunctionParameterTypeHints = true, includeInlayVariableTypeHints = true, includeInlayVariableTypeHintsWhenTypeMatchesName = false, includeInlayPropertyDeclarationTypeHints = true, includeInlayFunctionLikeReturnTypeHints = true, includeInlayEnumMemberValueHints = true, }, }, },}
M.denols = { filetypes = typescript_filetypes, root_dir = function(bufnr, on_dir) local root = deno_root(bufnr) if root then on_dir(root) end end, on_attach = disable_formatting, settings = { deno = { enable = true, lint = true, unstable = true, }, },}
return M