Skip to content

Commit

Permalink
fix: send correct integration info to analytics (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawkyZ authored Nov 25, 2024
1 parent 52b807d commit ed05a5d
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Snyk.VisualStudio.Extension.2022/Language/SnykLanguageClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ public object GetInitializationOptions()
ManageBinariesAutomatically = options.BinariesAutoUpdate.ToString(),
EnableTrustedFoldersFeature = "false",
TrustedFolders = options.TrustedFolders.ToList(),
IntegrationName = options.IntegrationName,
IntegrationName = this.GetIntegrationName(options),
IntegrationVersion = this.GetIntegrationVersion(options),
FilterSeverity = new FilterSeverityOptions
{
Critical = false,
Expand All @@ -88,7 +89,6 @@ public object GetInitializationOptions()
AutomaticAuthentication = "false",
Endpoint = options.CustomEndpoint,
Insecure = options.IgnoreUnknownCA.ToString(),
IntegrationVersion = options.IntegrationVersion,
RequiredProtocolVersion = LsConstants.ProtocolVersion,
HoverVerbosity = 1,
OutputFormat = "plain",
Expand All @@ -97,6 +97,16 @@ public object GetInitializationOptions()
return initializationOptions;
}

private string GetIntegrationName(ISnykOptions options)
{
var compositeValue = $"{options.IntegrationEnvironment}@@{options.IntegrationName}";
return compositeValue;
}
private string GetIntegrationVersion(ISnykOptions options)
{
var compositeValue = $"{options.IntegrationEnvironmentVersion}@@{options.IntegrationVersion}";
return compositeValue;
}
public IEnumerable<string> FilesToWatch => null;

public bool ShowNotificationOnInitializeFailed => true;
Expand Down Expand Up @@ -186,9 +196,6 @@ public async Task StartServerAsync(bool shouldStart = false)

Logger.Information("Starting Language Server");
await StartAsync.InvokeAsync(this, EventArgs.Empty);
IsReady = true;
FireOnLanguageServerReadyAsyncEvent();
SendPluginInstalledEvent();
}
else
{
Expand Down Expand Up @@ -291,7 +298,7 @@ private async Task<string> GetLsDebugLevelAsync(ISnykOptions options)

private void Rpc_Disconnected(object sender, JsonRpcDisconnectedEventArgs e)
{

IsReady = false;
}

public async Task AttachForCustomMessageAsync(JsonRpc rpc)
Expand All @@ -301,6 +308,9 @@ public async Task AttachForCustomMessageAsync(JsonRpc rpc)
Rpc.AllowModificationWhileListening = true;
Rpc.ActivityTracingStrategy = null;
Rpc.AllowModificationWhileListening = false;
IsReady = true;
FireOnLanguageServerReadyAsyncEvent();
SendPluginInstalledEvent();
}

protected void OnStopping() { }
Expand Down

0 comments on commit ed05a5d

Please sign in to comment.