Handle undefined templates in workflow template cache

This commit is contained in:
Josh Gross
2023-03-17 13:23:43 -04:00
parent a8a68a8028
commit 8942a05502
5 changed files with 51 additions and 31 deletions
+11 -5
View File
@@ -44,14 +44,20 @@ export async function hover(document: TextDocument, position: Position, config?:
};
const parsedWorkflow = fetchOrParseWorkflow(file, document.uri);
if (!parsedWorkflow) {
if (!parsedWorkflow?.value) {
return null;
}
const template = await fetchOrConvertWorkflowTemplate(parsedWorkflow, document.uri, config, {
errorPolicy: ErrorPolicy.TryConversion,
fetchReusableWorkflowDepth: config?.fileProvider ? 1 : 0
});
const template = await fetchOrConvertWorkflowTemplate(
parsedWorkflow.context,
parsedWorkflow.value,
document.uri,
config,
{
errorPolicy: ErrorPolicy.TryConversion,
fetchReusableWorkflowDepth: config?.fileProvider ? 1 : 0
}
);
const tokenResult = findToken(position, parsedWorkflow.value);
const {token, keyToken, parent} = tokenResult;