From 6ea7e931f5febc9b448ac8e2a71b0510c7e7111a Mon Sep 17 00:00:00 2001 From: "Mariano Z." Date: Tue, 23 Sep 2025 20:59:57 -0300 Subject: [PATCH] dev: automated commit - 2025-09-23 20:59:57 --- lazy-lock.json | 10 ++++---- lsp/tsgo.lua | 52 ++++++++++++++++++++++++++++++---------- lsp/vtsls.lua | 39 ------------------------------ lua/plugins/lsp/init.lua | 15 ++---------- 4 files changed, 46 insertions(+), 70 deletions(-) delete mode 100644 lsp/vtsls.lua diff --git a/lazy-lock.json b/lazy-lock.json index 40e2c25..64fdb87 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -4,10 +4,10 @@ "blink.cmp": { "branch": "main", "commit": "327fff91fe6af358e990be7be1ec8b78037d2138" }, "cloak.nvim": { "branch": "main", "commit": "648aca6d33ec011dc3166e7af3b38820d01a71e4" }, "conform.nvim": { "branch": "master", "commit": "b4aab989db276993ea5dcb78872be494ce546521" }, - "fidget.nvim": { "branch": "main", "commit": "b45d21d33d61ed9295308eb6571c0a5f0f7f3765" }, + "fidget.nvim": { "branch": "main", "commit": "3f5475949679953af6d78654db29b944fa826e6a" }, "flash.nvim": { "branch": "main", "commit": "b68bda044d68e4026c4e1ec6df3c5afd7eb8e341" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" }, - "fzf-lua": { "branch": "main", "commit": "8d6c9cf1af8aa284e361519f9f9ebdba16f20f28" }, + "fzf-lua": { "branch": "main", "commit": "2388dcd61731ae158bf7dad2ae0419291837e557" }, "git-worktree.nvim": { "branch": "main", "commit": "3ad8c17a3d178ac19be925284389c14114638ebb" }, "gitlinker.nvim": { "branch": "master", "commit": "cc59f732f3d043b626c8702cb725c82e54d35c25" }, "gitsigns.nvim": { "branch": "main", "commit": "f780609807eca1f783a36a8a31c30a48fbe150c5" }, @@ -25,7 +25,7 @@ "nvim-dbee": { "branch": "master", "commit": "dda517694889a5d238d7aa407403984da9f80cc0" }, "nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" }, "nvim-lint": { "branch": "master", "commit": "0864f81c681e15d9bdc1156fe3a17bd07db5a3ed" }, - "nvim-lspconfig": { "branch": "master", "commit": "aafecf5b8bc0a768f1a97e3a6d5441e64dee79f9" }, + "nvim-lspconfig": { "branch": "master", "commit": "b3cce1419ca67871ae782b3e529652f8a016f0de" }, "nvim-spectre": { "branch": "master", "commit": "72f56f7585903cd7bf92c665351aa585e150af0f" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-ts-context-commentstring": { "branch": "main", "commit": "1b212c2eee76d787bbea6aa5e92a2b534e7b4f8f" }, @@ -37,7 +37,7 @@ "promise-async": { "branch": "main", "commit": "119e8961014c9bfaf1487bf3c2a393d254f337e2" }, "quicker.nvim": { "branch": "master", "commit": "6b88ca4d70e35df877d9564beba83f00ba0c3133" }, "render-markdown.nvim": { "branch": "main", "commit": "9ab9dade85d8c7d411cc89b592028da3d1b7955a" }, - "schemastore.nvim": { "branch": "main", "commit": "22f0c2f7c727a15b45b7bfcbbab533720223b840" }, + "schemastore.nvim": { "branch": "main", "commit": "68938d9751f0a0c2d1059d8fc077f50c5bbf3f91" }, "snacks.nvim": { "branch": "main", "commit": "d67a47739dfc652cfcf66c59e929c704a854b37a" }, "suda.vim": { "branch": "master", "commit": "9adda7d195222d4e2854efb2a88005a120296c47" }, "todo-comments.nvim": { "branch": "main", "commit": "304a8d204ee787d2544d8bc23cd38d2f929e7cc5" }, @@ -46,6 +46,6 @@ "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-hugo": { "branch": "master", "commit": "324fb8c7371d31701349c1192e25a0bdcf9898f8" }, "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, - "which-key.nvim": { "branch": "main", "commit": "370ec46f710e058c9c1646273e6b225acf47cbed" }, + "which-key.nvim": { "branch": "main", "commit": "904308e6885bbb7b60714c80ab3daf0c071c1492" }, "windsurf.vim": { "branch": "main", "commit": "a8d47ec54fe82df920b2545559f767003e8a7f8d" } } diff --git a/lsp/tsgo.lua b/lsp/tsgo.lua index 8a65dbf..7197aa7 100644 --- a/lsp/tsgo.lua +++ b/lsp/tsgo.lua @@ -1,16 +1,42 @@ +---@brief +--- +--- https://github.com/microsoft/typescript-go +--- +--- `typescript-go` is experimental port of the TypeScript compiler (tsc) and language server (tsserver) to the Go programming language. +--- +--- `tsgo` can be installed via npm `npm install @typescript/native-preview`. +--- +--- ### Monorepo support +--- +--- `tsgo` supports monorepos by default. It will automatically find the `tsconfig.json` or `jsconfig.json` corresponding to the package you are working on. +--- This works without the need of spawning multiple instances of `tsgo`, saving memory. +--- +--- It is recommended to use the same version of TypeScript in all packages, and therefore have it available in your workspace root. The location of the TypeScript binary will be determined automatically, but only once. +--- + +---@type vim.lsp.Config return { - settings = {}, - flags = {}, - filetypes = { "typescript" }, - cmd = { - "/home/mzunino/Dev/random/typescript-go/built/local", - "--lsp", - "-stdio", - }, - root_markers = { - "tsconfig.json", - "package.json", - "jsconfig.json", - ".git", + cmd = { "tsgo", "--lsp", "--stdio" }, + filetypes = { + "javascript", + "javascriptreact", + "javascript.jsx", + "typescript", + "typescriptreact", + "typescript.tsx", }, + root_dir = function(bufnr, on_dir) + -- The project root is where the LSP can be started from + -- As stated in the documentation above, this LSP supports monorepos and simple projects. + -- We select then from the project root, which is identified by the presence of a package + -- manager lock file. + local root_markers = { "package-lock.json", "yarn.lock", "pnpm-lock.yaml", "bun.lockb", "bun.lock" } + -- Give the root markers equal priority by wrapping them in a table + root_markers = vim.fn.has("nvim-0.11.3") == 1 and { root_markers, { ".git" } } + or vim.list_extend(root_markers, { ".git" }) + -- We fallback to the current working directory if no project root is found + local project_root = vim.fs.root(bufnr, root_markers) or vim.fn.getcwd() + + on_dir(project_root) + end, } diff --git a/lsp/vtsls.lua b/lsp/vtsls.lua deleted file mode 100644 index 81b6909..0000000 --- a/lsp/vtsls.lua +++ /dev/null @@ -1,39 +0,0 @@ -return { - -- explicitly add default filetypes, so that we can extend - -- them in related extras - filetypes = { - "javascript", - "javascriptreact", - "javascript.jsx", - "typescript", - "typescriptreact", - "typescript.tsx", - }, - settings = { - complete_function_calls = true, - vtsls = { - enableMoveToFileCodeAction = true, - autoUseWorkspaceTsdk = true, - experimental = { - maxInlayHintLength = 30, - completion = { - enableServerSideFuzzyMatch = true, - }, - }, - }, - typescript = { - updateImportsOnFileMove = { enabled = "always" }, - suggest = { - completeFunctionCalls = true, - }, - inlayHints = { - enumMemberValues = { enabled = true }, - functionLikeReturnTypes = { enabled = true }, - parameterNames = { enabled = "literals" }, - parameterTypes = { enabled = true }, - propertyDeclarationTypes = { enabled = true }, - variableTypes = { enabled = false }, - }, - }, - }, -} diff --git a/lua/plugins/lsp/init.lua b/lua/plugins/lsp/init.lua index d0484fd..ebb254b 100644 --- a/lua/plugins/lsp/init.lua +++ b/lua/plugins/lsp/init.lua @@ -179,19 +179,8 @@ return { end, }) - vim.lsp.config("ts_go_ls", { - cmd = { vim.loop.os_homedir() .. "/Dev/random/typescript-go/built/local/tsgo", "--lsp", "-stdio" }, - filetypes = { - "javascript", - "javascriptreact", - "javascript.jsx", - "typescript", - "typescriptreact", - "typescript.tsx", - }, - root_markers = { "tsconfig.json", "jsconfig.json", "package.json", ".git" }, + vim.lsp.enable({ + "tsgo", }) - - vim.lsp.enable("ts_go_ls") end, }