Use cache when validating with value providers
This commit is contained in:
@@ -93,7 +93,11 @@ documents.onDidChangeContent((change) => {
|
||||
async function validateTextDocument(textDocument: TextDocument): Promise<void> {
|
||||
const result = await validate(
|
||||
textDocument,
|
||||
valueProviders(sessionToken, repoWorkspaceMap)
|
||||
valueProviders(
|
||||
sessionToken,
|
||||
repos.find((repo) => textDocument.uri.startsWith(repo.workspaceUri)),
|
||||
cache
|
||||
)
|
||||
);
|
||||
|
||||
connection.sendDiagnostics({ uri: textDocument.uri, diagnostics: result });
|
||||
|
||||
@@ -9,9 +9,13 @@ import { getRunnerLabels } from "./value-providers/runs-on";
|
||||
|
||||
export function valueProviders(
|
||||
sessionToken: string | undefined,
|
||||
repoContext: RepositoryContext,
|
||||
repoContext: RepositoryContext | undefined,
|
||||
cache: TTLCache
|
||||
): ValueProviderConfig {
|
||||
if (!repoContext) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
"job-environment": passOctoKit(
|
||||
sessionToken,
|
||||
|
||||
@@ -29,9 +29,11 @@ export async function getRunnerLabels(
|
||||
undefined,
|
||||
() => fetchRunnerLabels(client, owner, name)
|
||||
);
|
||||
|
||||
for (const label of defaultLabels) {
|
||||
repoLabels.add(label);
|
||||
}
|
||||
|
||||
return Array.from(repoLabels).map((label) => ({ label }));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user