From deacb61b14725d2a3e394fe2f29475d6b928d65c Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Wed, 30 Jul 2025 10:42:52 +1000 Subject: [PATCH] Fix resolving a tsconfig directory to a file path When a project is configured with its tsconfig pointing to a directory rather than a file, it needs to be resolved to a file before trying to read the contents of the file. Fixes https://github.com/mdx-js/mdx-analyzer/issues/481. I've raised this as an upstream issue too via https://github.com/volarjs/volar.js/issues/283. --- packages/language-server/lib/index.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/language-server/lib/index.js b/packages/language-server/lib/index.js index 78072451..608aba1f 100755 --- a/packages/language-server/lib/index.js +++ b/packages/language-server/lib/index.js @@ -52,9 +52,17 @@ connection.onInitialize(async (parameters) => { createTypeScriptProject( typescript, diagnosticMessages, - ({configFileName}) => ({ - languagePlugins: getLanguagePlugins(configFileName) - }) + ({configFileName}) => { + // Workaround for https://github.com/volarjs/volar.js/issues/283 + configFileName &&= typescript.findConfigFile( + configFileName, + typescript.sys.fileExists + ) + + return { + languagePlugins: getLanguagePlugins(configFileName) + } + } ), getLanguageServicePlugins() )