Combine methods

This commit is contained in:
Jacob Wallraff
2023-03-06 15:16:26 -08:00
parent 0001dd045c
commit b272ab29be
16 changed files with 42 additions and 70 deletions
+3 -10
View File
@@ -28,12 +28,7 @@ import {fetchActionMetadata} from "./utils/action-metadata";
import {TTLCache} from "./utils/cache";
import {timeOperation} from "./utils/timer";
import {valueProviders} from "./value-providers";
import {
clearParsedCache,
clearParsedCacheEntry,
clearWorkflowTemplateCache,
clearWorkflowTemplateCacheEntry
} from "@github/actions-languageservice/utils/workflow-cache";
import {clearCacheEntry, clearCache} from "@github/actions-languageservice/utils/workflow-cache";
export function initConnection(connection: Connection) {
const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);
@@ -100,8 +95,7 @@ export function initConnection(connection: Connection) {
connection.onInitialized(() => {
if (hasWorkspaceFolderCapability) {
connection.workspace.onDidChangeWorkspaceFolders(_event => {
clearParsedCache();
clearWorkflowTemplateCache();
clearCache();
});
}
});
@@ -109,8 +103,7 @@ export function initConnection(connection: Connection) {
// 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 => {
clearParsedCacheEntry(change.document.uri);
clearWorkflowTemplateCacheEntry(change.document.uri);
clearCacheEntry(change.document.uri);
return timeOperation("validation", async () => await validateTextDocument(change.document));
});