Skip to content

Commit

Permalink
Fix 'tl not found' error when modifying compilerPath while a document…
Browse files Browse the repository at this point in the history
… is open
  • Loading branch information
pdesaulniers committed Dec 13, 2023
1 parent c77fdcf commit 92d8346
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, TealServerSettings> = new Map();

Expand Down Expand Up @@ -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<TealServerSettings> {
Expand Down

0 comments on commit 92d8346

Please sign in to comment.