From 157f1c36db6eabeb09e3362b7f521d189d702f2d Mon Sep 17 00:00:00 2001 From: NullVoxPopuli-ai-agent <268630448+NullVoxPopuli-ai-agent@users.noreply.github.com> Date: Tue, 25 Aug 2026 13:24:56 -0400 Subject: [PATCH] Resolve the tsc binary in our own cmd function nvim-lspconfig d217766 moved the tsc binary resolution into its default root_dir function, cached per root. Our content-mapper override replaces root_dir, so the cache stays empty and the client fell back to a bare 'tsc' that is not on PATH. Resolve /node_modules/.bin/tsc in a self-contained cmd function instead of depending on lspconfig internals. Co-Authored-By: Claude Fable 5 --- lua/ember/lsp/typescript.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lua/ember/lsp/typescript.lua b/lua/ember/lsp/typescript.lua index 99f2879..8e8c792 100644 --- a/lua/ember/lsp/typescript.lua +++ b/lua/ember/lsp/typescript.lua @@ -81,6 +81,23 @@ vim.lsp.config('glint', { vim.lsp.config('tsc', { root_dir = utils.is_content_mapper_project, filetypes = tsFiletypes, + -- nvim-lspconfig's default `tsc` cmd resolves the binary inside its own + -- root_dir function (via a private bin cache). Overriding root_dir above + -- bypasses that, so resolve the workspace binary here instead. + cmd = function(dispatchers, config) + local cmd = 'tsc' + local root = (config or {}).root_dir + + if root then + local localBin = vim.fs.joinpath(root, 'node_modules/.bin/tsc') + + if vim.fn.executable(localBin) == 1 then + cmd = localBin + end + end + + return vim.lsp.rpc.start({ cmd, '--lsp', '--stdio' }, dispatchers) + end, init_options = { -- Content mappers spawn processes declared by the project, so TypeScript -- requires this explicit opt-in (VS Code sends it for trusted workspaces).