Skip to content

Instantly share code, notes, and snippets.

@kr-alt
Created March 12, 2025 16:12
Show Gist options
  • Save kr-alt/24aaf4bad50d603c3c6a270502e57209 to your computer and use it in GitHub Desktop.
Save kr-alt/24aaf4bad50d603c3c6a270502e57209 to your computer and use it in GitHub Desktop.
lsp config to test out the new tsgo LSP
local function start_tsgo()
local root_files = { "tsconfig.json", "jsconfig.json", "package.json", ".git" }
local paths = vim.fs.find(root_files, { stop = vim.env.HOME })
local root_dir = vim.fs.dirname(paths[1])
if root_dir == nil then
-- root directory was not found
return
end
vim.lsp.start({
name = "tsgo",
cmd = { "/path/to/tsgo", "lsp", "--stdio" },
root_dir = root_dir,
-- init_options = { hostInfo = "neovim" }, -- not implemented yet
})
end
vim.api.nvim_create_autocmd("FileType", {
pattern = { "javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx" },
desc = "Start tsgo LSP",
callback = start_tsgo,
})
@jellli
Copy link

jellli commented Mar 18, 2025

tysm!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment