-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
154647c
commit 0bc72d0
Showing
10 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Snyk.VisualStudio.Extension.2022/Service/FeatureFlagService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Threading.Tasks; | ||
using Serilog; | ||
using Snyk.Common; | ||
using Snyk.Common.Settings; | ||
using Snyk.VisualStudio.Extension.Language; | ||
|
||
namespace Snyk.VisualStudio.Extension.Service; | ||
|
||
public class FeatureFlagService(ILanguageClientManager languageClient, ISnykOptions settings) | ||
{ | ||
private readonly ILogger logger = LogManager.ForContext<FeatureFlagService>(); | ||
|
||
public async Task OnLanguageServerReadyAsync(object sender, SnykLanguageServerEventArgs args) | ||
{ | ||
var result = await languageClient.InvokeGetFeatureFlagStatusAsync(LsConstants.SnykGetFeatureFlagStatus, SnykVSPackage.Instance.DisposalToken); | ||
var response = Json.Deserialize<FeatureFlagResponse>(result); | ||
settings.ConsistentIgnoresEnabled = response.Ok; | ||
if (!response.Ok) | ||
{ | ||
if (!response.UserMessage.IsNullOrEmpty()) this.logger.Error("feature flag not enabled: {UserMessage}", response.UserMessage); | ||
} | ||
} | ||
|
||
private class FeatureFlagResponse | ||
{ | ||
public bool Ok { get; set; } | ||
public string UserMessage { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters