Skip to content

Commit

Permalink
Merge pull request #53 from semgrep/austin/cdx-355
Browse files Browse the repository at this point in the history
fix small brain async code
  • Loading branch information
ajbt200128 authored Apr 9, 2024
2 parents 5f8fa87 + 8263760 commit a34fdb5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/kotlin/com/semgrep/idea/actions/LoginAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import com.semgrep.idea.lsp.custom_requests.LoginRequest
class LoginAction(private val notification: Notification? = null) : LspAction("Sign In with Semgrep") {
override fun actionPerformed(e: AnActionEvent, servers: List<com.semgrep.idea.lsp.SemgrepLspServer>) {
val loginRequest = LoginRequest(servers.first())
val response = loginRequest.sendRequest().join() ?: return
BrowserUtil.browse(response.url)
servers.forEach {
LoginFinishRequest(it, response).sendNotification()
loginRequest.sendRequest().thenApply { response ->
BrowserUtil.browse(response.url)
servers.forEach {
LoginFinishRequest(it, response).sendNotification()
}
notification?.expire()
}
notification?.expire()

}
}

0 comments on commit a34fdb5

Please sign in to comment.