Simple caching for parsed workflow and template
This commit is contained in:
@@ -77,7 +77,7 @@ export async function complete(
|
||||
}
|
||||
|
||||
const {token, keyToken, parent, path} = findToken(newPos, result.value);
|
||||
const template = await convertWorkflowTemplate(result.context, result.value, config?.fileProvider, {
|
||||
const template = await convertWorkflowTemplate(file.name, result.context, result.value, config?.fileProvider, {
|
||||
fetchReusableWorkflowDepth: config?.fileProvider ? 1 : 0,
|
||||
errorPolicy: ErrorPolicy.TryConversion
|
||||
});
|
||||
|
||||
@@ -19,7 +19,7 @@ export async function documentLinks(document: TextDocument): Promise<DocumentLin
|
||||
return [];
|
||||
}
|
||||
|
||||
const template = await convertWorkflowTemplate(result.context, result.value!, undefined, {
|
||||
const template = await convertWorkflowTemplate(file.name, result.context, result.value!, undefined, {
|
||||
errorPolicy: ErrorPolicy.TryConversion
|
||||
});
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ export async function hover(document: TextDocument, position: Position, config?:
|
||||
const {token, keyToken, parent} = tokenResult;
|
||||
|
||||
const tokenDefinitionInfo = (keyToken || parent || token)?.definitionInfo;
|
||||
const template = await convertWorkflowTemplate(result.context, result.value, config?.fileProvider, {
|
||||
const template = await convertWorkflowTemplate(file.name, result.context, result.value, config?.fileProvider, {
|
||||
errorPolicy: ErrorPolicy.TryConversion,
|
||||
fetchReusableWorkflowDepth: config?.fileProvider ? 1 : 0
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ export async function testGetWorkflowContext(input: string): Promise<WorkflowCon
|
||||
let template: WorkflowTemplate | undefined;
|
||||
|
||||
if (result.value) {
|
||||
template = await convertWorkflowTemplate(result.context, result.value, testFileProvider, {
|
||||
template = await convertWorkflowTemplate("wf.yaml", result.context, result.value, testFileProvider, {
|
||||
fetchReusableWorkflowDepth: 1
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export async function validate(textDocument: TextDocument, config?: ValidationCo
|
||||
const result: ParseWorkflowResult = parseWorkflow(file, nullTrace);
|
||||
if (result.value) {
|
||||
// Errors will be updated in the context. Attempt to do the conversion anyway in order to give the user more information
|
||||
const template = await convertWorkflowTemplate(result.context, result.value, config?.fileProvider, {
|
||||
const template = await convertWorkflowTemplate(file.name, result.context, result.value, config?.fileProvider, {
|
||||
fetchReusableWorkflowDepth: config?.fileProvider ? 1 : 0,
|
||||
errorPolicy: ErrorPolicy.TryConversion
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user