From 92d83469f863b5092605e34f1f519c62e7359660 Mon Sep 17 00:00:00 2001 From: Patrick Desaulniers Date: Tue, 12 Dec 2023 19:29:17 -0500 Subject: [PATCH] Fix 'tl not found' error when modifying compilerPath while a document is open --- server/server.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/server/server.ts b/server/server.ts index 58070f3..d173e68 100644 --- a/server/server.ts +++ b/server/server.ts @@ -93,10 +93,6 @@ const defaultSettings: TealServerSettings = { let globalSettings: TealServerSettings = defaultSettings; -function getCompilerPath() { - return globalSettings.compilerPath; -} - // Cache the settings of all open documents let settingsCache: Map = new Map(); @@ -138,16 +134,18 @@ connection.onDidChangeConfiguration((change) => { ); } + typesCommandCache.clear(); + // Revalidate all open text documents documents.forEach(async function (x: TreeSitterDocument) { - const validVersion = await verifyMinimumTLVersion(globalSettings.compilerPath); + const settings = await getDocumentSettings(x.uri); + + const validVersion = await verifyMinimumTLVersion(settings.compilerPath); if (validVersion) { validateTextDocument(x.uri); } }); - - typesCommandCache.clear(); }); async function getDocumentSettings(uri: string): Promise {