From 3b61104e2a8984255f74827b0f1c23476ccd8209 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 26 Mar 2024 15:52:20 +0000 Subject: refactor(lsp): unify config file data into ConfigTree (#23032) --- cli/tsc/99_main_compiler.js | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'cli/tsc') diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index 32c3bf035..e6123d25e 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -503,9 +503,6 @@ delete Object.prototype.__proto__; } } - /** @type {ts.CompilerOptions} */ - let compilationSettings = {}; - /** @type {ts.LanguageService} */ let languageService; @@ -720,7 +717,17 @@ delete Object.prototype.__proto__; if (logDebug) { debug("host.getCompilationSettings()"); } - return compilationSettings; + const tsConfig = normalizeConfig(ops.op_ts_config()); + const { options, errors } = ts + .convertCompilerOptionsFromJson(tsConfig, ""); + Object.assign(options, { + allowNonTsExtensions: true, + allowImportingTsExtensions: true, + }); + if (errors.length > 0 && logDebug) { + debug(ts.formatDiagnostics(errors, host)); + } + return options; }, getScriptFileNames() { if (logDebug) { @@ -1010,21 +1017,6 @@ delete Object.prototype.__proto__; serverRestart(); return respond(id, true); } - case "$configure": { - const config = normalizeConfig(args[0]); - const { options, errors } = ts - .convertCompilerOptionsFromJson(config, ""); - Object.assign(options, { - allowNonTsExtensions: true, - allowImportingTsExtensions: true, - }); - if (errors.length > 0 && logDebug) { - debug(ts.formatDiagnostics(errors, host)); - } - compilationSettings = options; - moduleSpecifierCache.clear(); - return respond(id, true); - } case "$getSupportedCodeFixes": { return respond( id, -- cgit v1.2.3