Skip to content

Commit

Permalink
Lightbulb for editing config file, cmd to create config file (Azure#6187
Browse files Browse the repository at this point in the history
)

* Revert 'Remove light bulb that allows disabling linter rules in the bicepconfig.json (Azure#5314)'

* Lightbulb/cmd to edit config

* remove unused 'server'

* fix CR comment

* simple CR fixes

* fix build

* fix tests

* handle } on same line

* CR fix

* Fix targetFolder

* unused code

* CR fixes

* use StrictMock

* Improve test failure msg

* fix lint

* better error handling

* whoops

* force creation of special folder

* fix test - create temp folder

* fix unit test

* try to fix tests

* lint

* try again

* fix path issues

Co-authored-by: Stephen Weatherford <[email protected]>
Co-authored-by: Stephen Weatherford <Stephen.Weatherford.com>
  • Loading branch information
StephenWeatherford and Stephen Weatherford committed Mar 29, 2022
1 parent 0ffa35d commit aa9edec
Show file tree
Hide file tree
Showing 28 changed files with 1,730 additions and 21 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ If you have an active branch pushed to your GitHub fork, you can use the "Update
* On the first run, you'll need to ensure you have installed all the npm packages required by the Bicep VSCode extension with the following:
* `cd src/vscode-bicep`
* `npm i`
* In the [VSCode Run View](https://code.visualstudio.com/Docs/editor/debugging), select the "Bicep VSCode Extension" task, and press the "Start" button. This will launch a new VSCode window with the Bicep extension and LanguageServer containing your changes. When running on WSL, create a symbolic link in `src/vscode-bicep` named `bicepLanguageServer` to `../Bicep.LangServer/bin/Debug/net6.0`.
* If you want the ability to put breakpoints and step through the C# code, you can also use the "Attach" run configuration once the extension host has launched, and select the Bicep LanguageServer process by searching for "bicep".
* In the [VSCode Run View](https://code.visualstudio.com/Docs/editor/debugging), select the "VSCode Extension" task, and press the "Start" button. This will launch a new VSCode window with the Bicep extension and LanguageServer containing your changes. When running on WSL, create a symbolic link in `src/vscode-bicep` named `bicepLanguageServer` to `../Bicep.LangServer/bin/Debug/net6.0`.
* If you want the ability to set breakpoints and step through the C# code, you can also use the "Attach" run configuration once the extension host has launched, and select the Bicep LanguageServer process by searching for "dotnet" processes with a command line containing "...\Bicep.LangServer.dll --pipe=..." (Windows) or "vscode-*.sock" (MacOs).

### Running the Bicep CLI

Expand Down
4 changes: 2 additions & 2 deletions src/Bicep.Cli/CliResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
// Licensed under the MIT License.

using Bicep.Core.Analyzers.Linter.Rules;
using Bicep.Core.UnitTests.Assertions;
using FluentAssertions;
using FluentAssertions.Execution;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;

namespace Bicep.Core.UnitTests.Diagnostics.LinterRuleTests
{
Expand Down
2 changes: 1 addition & 1 deletion src/Bicep.Core.UnitTests/SourceFiles/ResXFileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private void AssertDoesNotContainTabs(string relativePath, string text)
{
if (text.Contains('\t'))
{
throw new Exception($"{relativePath} should be indented with spaces, not tabs. ${Info}");
throw new Exception($"{relativePath} should be indented with spaces, not tabs. {Info}");
}
}

Expand Down
20 changes: 20 additions & 0 deletions src/Bicep.Core/Configuration/DefaultBicepConfigHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

namespace Bicep.Core.Configuration
{
public static class DefaultBicepConfigHelper
{
public static string GetDefaultBicepConfig()
{
return @"{
""analyzers"": {
""core"": {
""rules"": {
}
}
}
}";
}
}
}
3 changes: 3 additions & 0 deletions src/Bicep.Core/LanguageConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public static class LanguageConstants

public const string BicepConfigurationFileName = "bicepconfig.json";

// An internal-only command used in code actions to edit a particular rule in the bicepconfig.json file
public const string EditLinterRuleCommandName = "bicep.EditLinterRule";

public const string DisableNextLineDiagnosticsKeyword = "disable-next-line";

public static readonly Regex ArmTemplateSchemaRegex = new(@"https?:\/\/schema\.management\.azure\.com\/schemas\/([^""\/]+\/[a-zA-Z]*[dD]eploymentTemplate\.json)#?");
Expand Down
Loading

0 comments on commit aa9edec

Please sign in to comment.