Skip to content

Commit

Permalink
Add support for JetBrains IDEs v2022.3
Browse files Browse the repository at this point in the history
  • Loading branch information
felladrin committed Sep 16, 2022
1 parent 686963b commit 7a561cf
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
9 changes: 5 additions & 4 deletions components/ide/jetbrains/backend-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ detekt {

tasks {
withType<JavaCompile> {
sourceCompatibility = "11"
targetCompatibility = "11"
sourceCompatibility = "17"
targetCompatibility = "17"
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "11"
kotlinOptions.jvmTarget = "17"
}

withType<Detekt> {
jvmTarget = "11"
jvmTarget = "17"
}

buildSearchableOptions {
Expand All @@ -118,6 +118,7 @@ tasks {
}

runPluginVerifier {
enabled = false
ideVersions.set(properties("pluginVerifierIdeVersions").split(',').map(String::trim).filter(String::isNotEmpty))
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
pluginSinceBuild=222
pluginUntilBuild=222.*
pluginSinceBuild=223.4884
pluginUntilBuild=223.*
# Plugin Verifier integration -> https://github.com/JetBrains/gradle-intellij-plugin#plugin-verifier-dsl
# See https://jb.gg/intellij-platform-builds-list for available build versions.
pluginVerifierIdeVersions=2022.2
pluginVerifierIdeVersions=2022.3
# Version from "com.jetbrains.intellij.idea" which can be found at https://www.jetbrains.com/intellij-repository/snapshots
platformVersion=222.4167-EAP-CANDIDATE-SNAPSHOT
platformVersion=223.4884-EAP-CANDIDATE-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.http.FullHttpRequest
import io.netty.handler.codec.http.QueryStringDecoder
import io.prometheus.client.exporter.common.TextFormat
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.jetbrains.ide.RestService
import org.jetbrains.io.response
import java.io.OutputStreamWriter
import java.nio.file.InvalidPathException
import java.nio.file.Path

@Suppress("UnstableApiUsage")
@Suppress("UnstableApiUsage", "OPT_IN_USAGE")
class GitpodCLIService : RestService() {

private val manager = service<GitpodManager>()
Expand Down Expand Up @@ -65,7 +69,11 @@ class GitpodCLIService : RestService() {
val file = parseFilePath(fileStr) ?: return "invalid file"
val shouldWait = getBooleanParameter("wait", urlDecoder)
return withClient(request, context) {
CommandLineProcessor.doOpenFileOrProject(file, shouldWait).future.get()
GlobalScope.launch {
withContext(Dispatchers.IO) {
CommandLineProcessor.doOpenFileOrProject(file, shouldWait).future.get()
}
}
}
}
if (operation == "preview") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ package io.gitpod.jetbrains.remote

import com.intellij.codeWithMe.ClientId
import com.intellij.ide.BrowserUtil
import com.intellij.idea.StartupUtil
import com.intellij.idea.getServerFutureAsync
import com.intellij.notification.NotificationAction
import com.intellij.notification.NotificationType
import com.intellij.openapi.Disposable
Expand Down Expand Up @@ -120,7 +120,7 @@ class GitpodClientProjectSessionTracker(

// Ignore ports that aren't actually used by the user (e.g. ports used internally by JetBrains IDEs)
val backendPort = BuiltInServerManager.getInstance().waitForStart().port
val serverPort = StartupUtil.getServerFuture().await().port
val serverPort = getServerFutureAsync().await()?.port
val ignorePorts = listOf(backendPort, serverPort, 5990)
val portsStatus = hashMapOf<Int, PortsStatus>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ class GitpodPortForwardingService(private val project: Project) {
for (port in response.portsList) {
val hostPort = port.localPort
val isServed = port.served
val existingForwardedPort = forwardedPortsList.find { it.hostPort == hostPort }

if (isServed && !forwardedPortsList.containsKey(hostPort)) {
if (isServed && existingForwardedPort == null) {
val portEventsProcessor = object : PortEventsProcessor {
override fun onPortForwarded(hostPort: Int, clientPort: Int) {
portsService.setForwardedPort(hostPort, clientPort)
Expand All @@ -111,15 +112,18 @@ class GitpodPortForwardingService(private val project: Project) {
val portInfo = ForwardedPortInfo(
hostPort,
RdPortType.HTTP,
FORWARDED_PORT_LABEL,
port.exposed.url,
port.name,
port.description,
setOf(FORWARDED_PORT_LABEL),
emptyList(),
portEventsProcessor
)

portForwardingManager.forwardPort(portInfo)
}

if (!isServed && forwardedPortsList.containsKey(hostPort)) {
if (!isServed && existingForwardedPort != null) {
portForwardingManager.removePort(hostPort)
portsService.removeForwardedPort(hostPort)
thisLogger().info("gitpod: Stopped forwarding port $hostPort.")
Expand Down

0 comments on commit 7a561cf

Please sign in to comment.