Merge pull request #172 from github/thyeggman/cache-workflow-results

Cache parsed workflow and template results
This commit is contained in:
Jacob Wallraff
2023-03-08 09:18:44 -08:00
committed by GitHub
18 changed files with 151 additions and 39 deletions
+10
View File
@@ -28,6 +28,7 @@ import {fetchActionMetadata} from "./utils/action-metadata";
import {TTLCache} from "./utils/cache";
import {timeOperation} from "./utils/timer";
import {valueProviders} from "./value-providers";
import {clearCacheEntry, clearCache} from "@github/actions-languageservice/utils/workflow-cache";
export function initConnection(connection: Connection) {
const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);
@@ -91,9 +92,18 @@ export function initConnection(connection: Connection) {
return result;
});
connection.onInitialized(() => {
if (hasWorkspaceFolderCapability) {
connection.workspace.onDidChangeWorkspaceFolders(_event => {
clearCache();
});
}
});
// The content of a text document has changed. This event is emitted
// when the text document first opened or when its content has changed.
documents.onDidChangeContent(change => {
clearCacheEntry(change.document.uri);
return timeOperation("validation", async () => await validateTextDocument(change.document));
});