Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back button to add param files on linked deployments #1231

Merged
merged 2 commits into from
Mar 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/documents/templates/ChildTemplateCodeLens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ import { assertNever } from '../../util/assertNever';
import { parseUri, stringifyUri } from "../../util/uri";
import { ResolvableCodeLens } from '../DeploymentDocument';
import { IParameterValuesSourceProvider } from '../parameters/IParameterValuesSourceProvider';
import { SelectParameterFileCodeLens } from "./deploymentTemplateCodeLenses";
import { ILinkedTemplateReference } from "./linkedTemplates/ILinkedTemplateReference";
import { LinkedFileLoadState } from "./linkedTemplates/LinkedFileLoadState";
import { IFullValidationStatus } from "./linkedTemplates/linkedTemplates";
import { TemplateScope, TemplateScopeKind } from './scopes/TemplateScope';
import { LinkedTemplateScope } from './scopes/templateScopes';

const fullValidationOffMsg = "($(warning)full validation off)";
//const fullValidationOffMsg = "($(warning)full validation off)";

abstract class ChildTemplateCodeLens extends ResolvableCodeLens {
}
Expand Down Expand Up @@ -138,7 +139,7 @@ export class LinkedTemplateCodeLens extends ChildTemplateCodeLens {
}

if (!fullValidationStatus.fullValidationEnabled) {
title += ` ${fullValidationOffMsg}`;
// title += ` ${fullValidationOffMsg}`;
} else if (!firstLinkedTemplateRef) {
title += " " + "(cannot validate - make sure all other validation errors have been fixed)";
}
Expand Down Expand Up @@ -264,17 +265,16 @@ function addSelectParamFileLensIfNeeded(
scope: TemplateScope,
span: Span
): void {
/*
if (!fullValidationStatus.fullValidationEnabled) {
lenses.push(
new SelectParameterFileCodeLens(
scope,
span,
topLevelParameterValuesProvider?.parameterFileUri,
{
isForLinkedTemplate: true,
isForLinkedOrNestedTemplate: true,
fullValidationStatus
})
);
*/
}
}
5 changes: 4 additions & 1 deletion src/documents/templates/deploymentTemplateCodeLenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export class SelectParameterFileCodeLens extends ResolvableCodeLens {
span: Span,
private parameterFileUri: Uri | undefined,
private _options: {
isForLinkedOrNestedTemplate?: true;
fullValidationStatus: IFullValidationStatus | undefined;
}
) {
Expand All @@ -72,7 +73,9 @@ export class SelectParameterFileCodeLens extends ResolvableCodeLens {
title =
this._options.fullValidationStatus?.allParametersHaveDefaults ?
"Select or create a parameter file..." :
"Select or create a parameter file to enable full validation...";
this._options?.isForLinkedOrNestedTemplate ?
`$(warning) Full template validation off. Add parameter file or top-level parameter defaults to enable.` :
"Select or create a parameter file to enable full validation...";
}

this.command = {
Expand Down
3 changes: 2 additions & 1 deletion test/DeploymentTemplate.CodeLenses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ suite("DeploymentTemplate code lenses", () => {
[
"TopLevel: \"Select or create a parameter file to enable full validation...\" (azurerm-vscode-tools.selectParameterFile) at [1,1-1,1]",
"NestedDeploymentWithInnerScope: \"Nested template with inner scope\" () at [22,21-47,10]",
"NestedDeploymentWithInnerScope: \"$(warning) Full template validation off. Add parameter file or top-level parameter defaults to enable.\" (azurerm-vscode-tools.selectParameterFile) at [22,21-47,10]",
"NestedDeploymentWithInnerScope: \"Using default value\" (azurerm-vscode-tools.codeLens.gotoParameterValue) at [26,13-26,17]",
"NestedDeploymentWithInnerScope: \"Value: \"p2 value\"\" (azurerm-vscode-tools.codeLens.gotoParameterValue) at [30,13-30,17]",
"NestedDeploymentWithInnerScope: \"Value: \"[add(1, 2)]\"\" (azurerm-vscode-tools.codeLens.gotoParameterValue) at [33,13-33,17]",
Expand Down Expand Up @@ -421,7 +422,7 @@ suite("DeploymentTemplate code lenses", () => {
[
"TopLevel: \"Select or create a parameter file to enable full validation...\" (azurerm-vscode-tools.selectParameterFile) at [1,1-1,1]",
"NestedDeploymentWithInnerScope: \"Nested template with inner scope\" () at [14,21-39,10]",
"NestedDeploymentWithInnerScope: \"Using default value\" (azurerm-vscode-tools.codeLens.gotoParameterValue) at [18,13-18,17]",
"NestedDeploymentWithInnerScope: \"$(warning) Full template validation off. Add parameter file or top-level parameter defaults to enable.\" (azurerm-vscode-tools.selectParameterFile) at [14,21-39,10]", "NestedDeploymentWithInnerScope: \"Using default value\" (azurerm-vscode-tools.codeLens.gotoParameterValue) at [18,13-18,17]",
"NestedDeploymentWithInnerScope: \"$(warning) No value found - click here to enter a value\" (azurerm-vscode-tools.codeLens.gotoParameterValue) at [22,13-22,17]",
"NestedDeploymentWithInnerScope: \"$(warning) No value found - click here to enter a value\" (azurerm-vscode-tools.codeLens.gotoParameterValue) at [25,13-25,17]",
"NestedDeploymentWithInnerScope: \"$(warning) No value found - click here to enter a value\" (azurerm-vscode-tools.codeLens.gotoParameterValue) at [28,13-28,17]",
Expand Down