Run format

This commit is contained in:
Jacob Wallraff
2023-01-30 10:57:40 -08:00
parent 4d467ff677
commit 389831bc3c
4 changed files with 69 additions and 60 deletions
@@ -1,4 +1,4 @@
import descriptions from "./descriptions.json" assert { type: 'json' };
import descriptions from "./descriptions.json" assert {type: "json"};
export const RootContext = "root";
@@ -1,54 +1,54 @@
import check_run from "./check_run.json" assert { type: 'json' };
import check_suite from "./check_suite.json" assert { type: 'json' };
import commit_comment from "./commit_comment.json" assert { type: 'json' };
import content_reference from "./content_reference.json" assert { type: 'json' };
import create from "./create.json" assert { type: 'json' };
import deletePayload from "./delete.json" assert { type: 'json' };
import deploy_key from "./deploy_key.json" assert { type: 'json' };
import deployment from "./deployment.json" assert { type: 'json' };
import deployment_status from "./deployment_status.json" assert { type: 'json' };
import fork from "./fork.json" assert { type: 'json' };
import github_app_authorization from "./github_app_authorization.json" assert { type: 'json' };
import gollum from "./gollum.json" assert { type: 'json' };
import installation from "./installation.json" assert { type: 'json' };
import installation_repositories from "./installation_repositories.json" assert { type: 'json' };
import issue_comment from "./issue_comment.json" assert { type: 'json' };
import issues from "./issues.json" assert { type: 'json' };
import label from "./label.json" assert { type: 'json' };
import marketplace_purchase from "./marketplace_purchase.json" assert { type: 'json' };
import member from "./member.json" assert { type: 'json' };
import membership from "./membership.json" assert { type: 'json' };
import merge_group from "./merge_group.json" assert { type: 'json' };
import meta from "./meta.json" assert { type: 'json' };
import milestone from "./milestone.json" assert { type: 'json' };
import org_block from "./org_block.json" assert { type: 'json' };
import organization from "./organization.json" assert { type: 'json' };
import packagePayload from "./package_payload.json" assert { type: 'json' };
import page_build from "./page_build.json" assert { type: 'json' };
import ping from "./ping.json" assert { type: 'json' };
import project from "./project.json" assert { type: 'json' };
import project_card from "./project_card.json" assert { type: 'json' };
import project_column from "./project_column.json" assert { type: 'json' };
import publicPayload from "./public.json" assert { type: 'json' };
import pull_request from "./pull_request.json" assert { type: 'json' };
import pull_request_review from "./pull_request_review.json" assert { type: 'json' };
import pull_request_review_comment from "./pull_request_review_comment.json" assert { type: 'json' };
import push from "./push.json" assert { type: 'json' };
import release from "./release.json" assert { type: 'json' };
import repository from "./repository.json" assert { type: 'json' };
import repository_dispatch from "./repository_dispatch.json" assert { type: 'json' };
import repository_import from "./repository_import.json" assert { type: 'json' };
import repository_vulnerability_alert from "./repository_vulnerability_alert.json" assert { type: 'json' };
import schedule from "./schedule.json" assert { type: 'json' };
import security_advisory from "./security_advisory.json" assert { type: 'json' };
import sponsorship from "./sponsorship.json" assert { type: 'json' };
import star from "./star.json" assert { type: 'json' };
import status from "./status.json" assert { type: 'json' };
import team from "./team.json" assert { type: 'json' };
import team_add from "./team_add.json" assert { type: 'json' };
import watch from "./watch.json" assert { type: 'json' };
import workflow_dispatch from "./workflow_dispatch.json" assert { type: 'json' };
import workflow_run from "./workflow_run.json" assert { type: 'json' };
import check_run from "./check_run.json" assert {type: "json"};
import check_suite from "./check_suite.json" assert {type: "json"};
import commit_comment from "./commit_comment.json" assert {type: "json"};
import content_reference from "./content_reference.json" assert {type: "json"};
import create from "./create.json" assert {type: "json"};
import deletePayload from "./delete.json" assert {type: "json"};
import deploy_key from "./deploy_key.json" assert {type: "json"};
import deployment from "./deployment.json" assert {type: "json"};
import deployment_status from "./deployment_status.json" assert {type: "json"};
import fork from "./fork.json" assert {type: "json"};
import github_app_authorization from "./github_app_authorization.json" assert {type: "json"};
import gollum from "./gollum.json" assert {type: "json"};
import installation from "./installation.json" assert {type: "json"};
import installation_repositories from "./installation_repositories.json" assert {type: "json"};
import issue_comment from "./issue_comment.json" assert {type: "json"};
import issues from "./issues.json" assert {type: "json"};
import label from "./label.json" assert {type: "json"};
import marketplace_purchase from "./marketplace_purchase.json" assert {type: "json"};
import member from "./member.json" assert {type: "json"};
import membership from "./membership.json" assert {type: "json"};
import merge_group from "./merge_group.json" assert {type: "json"};
import meta from "./meta.json" assert {type: "json"};
import milestone from "./milestone.json" assert {type: "json"};
import org_block from "./org_block.json" assert {type: "json"};
import organization from "./organization.json" assert {type: "json"};
import packagePayload from "./package_payload.json" assert {type: "json"};
import page_build from "./page_build.json" assert {type: "json"};
import ping from "./ping.json" assert {type: "json"};
import project from "./project.json" assert {type: "json"};
import project_card from "./project_card.json" assert {type: "json"};
import project_column from "./project_column.json" assert {type: "json"};
import publicPayload from "./public.json" assert {type: "json"};
import pull_request from "./pull_request.json" assert {type: "json"};
import pull_request_review from "./pull_request_review.json" assert {type: "json"};
import pull_request_review_comment from "./pull_request_review_comment.json" assert {type: "json"};
import push from "./push.json" assert {type: "json"};
import release from "./release.json" assert {type: "json"};
import repository from "./repository.json" assert {type: "json"};
import repository_dispatch from "./repository_dispatch.json" assert {type: "json"};
import repository_import from "./repository_import.json" assert {type: "json"};
import repository_vulnerability_alert from "./repository_vulnerability_alert.json" assert {type: "json"};
import schedule from "./schedule.json" assert {type: "json"};
import security_advisory from "./security_advisory.json" assert {type: "json"};
import sponsorship from "./sponsorship.json" assert {type: "json"};
import star from "./star.json" assert {type: "json"};
import status from "./status.json" assert {type: "json"};
import team from "./team.json" assert {type: "json"};
import team_add from "./team_add.json" assert {type: "json"};
import watch from "./watch.json" assert {type: "json"};
import workflow_dispatch from "./workflow_dispatch.json" assert {type: "json"};
import workflow_run from "./workflow_run.json" assert {type: "json"};
export const eventPayloads: {[key: string]: Object} = {
check_run,
+13 -6
View File
@@ -17,7 +17,7 @@ function testHoverConfig(tokenValue: string, tokenKey: string, description?: str
return description;
}
} satisfies DescriptionProvider
} satisfies HoverConfig
} satisfies HoverConfig;
}
describe("hover", () => {
@@ -146,7 +146,8 @@ jobs:
expect(result).not.toBeUndefined();
// The `ref` is a `string` definition and inherits the context from `step-with`
const expected = "**Context:** github, inputs, vars, needs, strategy, matrix, secrets, steps, job, runner, env, hashFiles(1,255)"
const expected =
"**Context:** github, inputs, vars, needs, strategy, matrix, secrets, steps, job, runner, env, hashFiles(1,255)";
expect(result?.contents).toEqual(expected);
});
});
@@ -164,11 +165,15 @@ jobs:
ref|: main
`;
const result = await hover(...getPositionFromCursor(input), testHoverConfig("ref", "string", "The branch, tag or SHA to checkout."));
const result = await hover(
...getPositionFromCursor(input),
testHoverConfig("ref", "string", "The branch, tag or SHA to checkout.")
);
expect(result).not.toBeUndefined();
const expected = "The branch, tag or SHA to checkout.\n\n" +
"**Context:** github, inputs, vars, needs, strategy, matrix, secrets, steps, job, runner, env, hashFiles(1,255)"
const expected =
"The branch, tag or SHA to checkout.\n\n" +
"**Context:** github, inputs, vars, needs, strategy, matrix, secrets, steps, job, runner, env, hashFiles(1,255)";
expect(result?.contents).toEqual(expected);
});
@@ -184,6 +189,8 @@ jobs:
const result = await hover(...getPositionFromCursor(input), testHoverConfig("uses", "non-empty-string", undefined));
expect(result).not.toBeUndefined();
expect(result?.contents).toEqual("Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a published Docker container image.");
expect(result?.contents).toEqual(
"Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a published Docker container image."
);
});
});
+4 -2
View File
@@ -39,7 +39,7 @@ export async function hover(document: TextDocument, position: Position, config?:
info(`Calculating hover for token with definition ${token.definition.key}`);
if (tokenResult.parent && isCronMappingValue(tokenResult)) {
const tokenValue = (token as StringToken).value
const tokenValue = (token as StringToken).value;
let description = getCronDescription(tokenValue);
if (description) {
return {
@@ -82,7 +82,9 @@ async function getDescription(
}
function isCronMappingValue(tokenResult: TokenResult): boolean {
return tokenResult.parent?.definition?.key === "cron-mapping" &&
return (
tokenResult.parent?.definition?.key === "cron-mapping" &&
isString(tokenResult.token!) &&
tokenResult.token.value !== "cron"
);
}