From bdaa7009fe1ba56b309236c11262b2cb9da5d0d9 Mon Sep 17 00:00:00 2001 From: Michael Lingelbach Date: Thu, 7 Jan 2021 22:41:43 -0800 Subject: tsserver: fix root detection to prefer tsconfig.json --- lua/lspconfig/tsserver.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/lspconfig/tsserver.lua b/lua/lspconfig/tsserver.lua index d95e7d54..a3a78a71 100644 --- a/lua/lspconfig/tsserver.lua +++ b/lua/lspconfig/tsserver.lua @@ -11,7 +11,10 @@ configs[server_name] = { default_config = { cmd = {bin_name, "--stdio"}; filetypes = {"javascript", "javascriptreact", "javascript.jsx", "typescript", "typescriptreact", "typescript.tsx"}; - root_dir = util.root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"); + root_dir = function(fname) + return util.root_pattern("tsconfig.json")(fname) or + util.root_pattern("package.json", "jsconfig.json", ".git")(fname); + end }; docs = { description = [[ -- cgit v1.2.3-70-g09d2