Skip to content

Commit

Permalink
feat: ensure feature doesn't break UX
Browse files Browse the repository at this point in the history
  • Loading branch information
bastiandoetsch committed Nov 8, 2023
1 parent 68bd063 commit 443a2da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/main/kotlin/io/snyk/plugin/SnykPostStartupActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ class SnykPostStartupActivity : ProjectActivity {

if (!ApplicationManager.getApplication().isUnitTestMode) {
getSnykTaskQueueService(project)?.downloadLatestRelease()
getSnykTaskQueueService(project)?.initializeLanguageServer()
getAnalyticsScanListener(project)?.initScanListener()
try {
getSnykTaskQueueService(project)?.initializeLanguageServer()
getAnalyticsScanListener(project)?.initScanListener()
} catch (ignored: Exception) {
// do nothing to not break UX for analytics
}
}

val feedbackRequestShownMoreThenTwoWeeksAgo =
Expand Down
14 changes: 9 additions & 5 deletions src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,15 @@ class LanguageServerWrapper(private val lsPath: String = getCliFile().absolutePa
}

fun sendReportAnalyticsCommand(scanDoneEvent: ScanDoneEvent) {
val eventString = gson.toJson(scanDoneEvent)
val param = ExecuteCommandParams()
param.command = "snyk.reportAnalytics"
param.arguments = listOf(eventString)
languageServer.workspaceService.executeCommand(param)
try {
val eventString = gson.toJson(scanDoneEvent)
val param = ExecuteCommandParams()
param.command = "snyk.reportAnalytics"
param.arguments = listOf(eventString)
languageServer.workspaceService.executeCommand(param)
} catch (ignored: Exception) {
// do nothing to not break UX for analytics
}
}

fun getInitializationOptions(): LanguageServerSettings {
Expand Down

0 comments on commit 443a2da

Please sign in to comment.