Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions intellij-plugin/hs-Go/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@ plugins {
id("intellij-plugin-module-conventions")
}

// Almost all Go plugin classes we use (`GoSdk`, `GoSdkList`, `GoSdkService`, `GoTestRunConfiguration`, etc.)
// live in its `intellij.go.impl` content module. Since 2026.3 the module is no longer embedded:
// it has its own classloader, so it must be declared explicitly, or every Go course fails with `NoClassDefFoundError`.
// In 2025.3-2026.2 the module is embedded, so a dependency on the Go plugin is enough.
// In 2025.2 the module doesn't exist, and declaring it would stop `hs-Go` from loading
private val goModuleDependenciesMarker = "<!-- GO_MODULE_DEPENDENCIES -->"
private val goModuleDependencies = if (environmentName.toInt() >= 263) {
listOf(
"intellij.go.impl",
).joinToString("\n") { " <module name=\"$it\"/>" }
}
else {
""
}

dependencies {
intellijPlatform {
intellijIde(ideaVersion)
Expand All @@ -17,3 +32,12 @@ dependencies {

testImplementation(project(":intellij-plugin:hs-core", "testOutput"))
}

tasks.processResources {
inputs.property("goModuleDependencies", goModuleDependencies)
filesMatching("hs-Go.xml") {
filter { line ->
if (goModuleDependenciesMarker in line) goModuleDependencies else line
}
}
}
2 changes: 2 additions & 0 deletions intellij-plugin/hs-Go/resources/hs-Go.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!--suppress PluginXmlValidity -->
<dependencies>
<plugin id="org.jetbrains.plugins.go"/>
<!-- Go 2026.3+ module dependencies are inserted here by build.gradle.kts. -->
<!-- GO_MODULE_DEPENDENCIES -->
</dependencies>

<extensions defaultExtensionNs="HyperskillEducational">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ error.invalid.name=Name contains forbidden symbols
error.no.sdk=Specify Go SDK. Learn how to configure Go SDK <a href="{0}">here</a>
error.invalid.sdk=Go SDK is invalid. Specify another Go SDK. Learn how to configure Go SDK <a href="">here</a>
error.invalid.sdk.location=Go SDK can't be in the course directory. Specify another Go SDK. Learn how to configure Go SDK <a href="">here</a>

# Progress
progress.title.discovering.go.sdks=Discovering Go SDKs...
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.hyperskill.academy.go

import com.goide.i18n.GoBundle
import com.goide.sdk.GoSdk
import com.goide.sdk.combobox.GoSdkList
import com.intellij.openapi.components.Service
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.Task
import org.hyperskill.academy.go.messages.EduGoBundle
import java.util.concurrent.atomic.AtomicBoolean

@Service(Service.Level.APP)
Expand All @@ -25,7 +25,8 @@ class GoSdkLoadService {

@Suppress("UsagesOfObsoleteApi") // `Task.Backgroundable` is used on purpose
private fun reloadSdks(action: (List<GoSdk>) -> Unit) =
object : Task.Backgroundable(null, GoBundle.message("go.settings.sdk.discovering.go.sdks.progress.title"), true) {
// The title has its own key: the Go plugin's `GoBundle` key for it was removed in 2027.1 (GO-11779)
object : Task.Backgroundable(null, EduGoBundle.message("progress.title.discovering.go.sdks"), true) {
override fun run(indicator: ProgressIndicator) {
require(isStarted.get()) {
"isStarted lock must be acquired"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,49 +1,21 @@
package org.hyperskill.academy.learning.newproject.coursesStorage

import com.intellij.openapi.components.*
import com.intellij.openapi.wm.impl.welcomeScreen.learnIde.coursesInProgress.CourseDataStorage
import com.intellij.openapi.wm.impl.welcomeScreen.learnIde.coursesInProgress.CourseInfo
import org.hyperskill.academy.learning.EduTestAware
import org.hyperskill.academy.learning.courseFormat.Course
import org.hyperskill.academy.learning.courseFormat.CourseMode
import org.hyperskill.academy.learning.newproject.ui.welcomeScreen.JBACourseFromStorage
import org.jetbrains.annotations.TestOnly

// It doesn't implement the platform's `CourseDataStorage`: nothing registers it as a `coursesStorageProvider` for the welcome screen Learn tab,
// and since 2027.1 that API lives in the separate `intellij.platform.ide.learnIde` module, so referencing it broke Browse Courses
@State(name = "HyperskillCoursesStorage", storages = [Storage("hsCoursesStorage.xml", roamingType = RoamingType.DISABLED)])
@Service
class CoursesStorage : CourseDataStorage, CoursesStorageBase(), EduTestAware {
class CoursesStorage : CoursesStorageBase(), EduTestAware {

override fun getCoursePath(course: Course): String? = getCoursePath(JBACourseFromStorage().apply {
this.name = course.name
this.id = course.id
this.courseMode = course.courseMode
this.languageId = course.languageId
this.languageVersion = course.languageVersion
})

private fun getCourseMetaInfo(name: String, id: Int, courseMode: CourseMode, languageId: String): JBACourseFromStorage? {
return state.courses.find {
it.name == name
&& it.id == id
&& it.courseMode == courseMode
&& it.languageId == languageId
}
}

override fun getCoursePath(courseInfo: CourseInfo): String? {
return if (courseInfo is JBACourseFromStorage) {
getCourseMetaInfo(courseInfo.name, courseInfo.id, courseInfo.courseMode, courseInfo.languageId)?.location
}
else {
null
}
}

override fun removeCourseByLocation(location: String): Boolean {
fun removeCourseByLocation(location: String): Boolean {
return super.doRemoveCourseByLocation(location)
}

override fun getAllCourses(): List<CourseInfo> {
fun getAllCourses(): List<JBACourseFromStorage> {
return state.courses
}

Expand All @@ -55,4 +27,4 @@ class CoursesStorage : CourseDataStorage, CoursesStorageBase(), EduTestAware {
companion object {
fun getInstance(): CoursesStorage = service()
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.hyperskill.academy.learning.newproject.ui.welcomeScreen

import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.wm.impl.welcomeScreen.learnIde.coursesInProgress.CourseInfo
import com.intellij.util.SlowOperations
import com.intellij.util.xmlb.annotations.OptionTag
import com.intellij.util.xmlb.annotations.Tag
Expand All @@ -10,15 +9,22 @@ import org.hyperskill.academy.learning.EduNames
import org.hyperskill.academy.learning.courseFormat.Course
import org.hyperskill.academy.learning.courseFormat.CourseMode
import org.hyperskill.academy.learning.courseFormat.hyperskill.HyperskillCourse
import org.hyperskill.academy.learning.newproject.ui.logo
import javax.swing.Icon

private const val PROGRAMMING_LANGUAGE = "programmingLanguage"
private const val PROGRAMMING_LANGUAGE_ID = "programmingLanguageId"
private const val PROGRAMMING_LANGUAGE_VERSION = "programmingLanguageVersion"

@Tag(EduNames.COURSE)
class JBACourseFromStorage() : CourseInfo() {
class JBACourseFromStorage() {
// These used to be inherited from the platform's `CourseInfo`, which moved to the separate `intellij.platform.ide.learnIde` module in 2027.1.
// The names and defaults are kept so that the stored courses read back the same
var id: Int = -1
var name: String = ""
var description: String = ""
var location: String = ""
var tasksTotal: Int = 0
var tasksSolved: Int = 0

var type: String = ""
var courseMode = CourseMode.STUDENT
var environment = ""
Expand Down Expand Up @@ -53,11 +59,6 @@ class JBACourseFromStorage() : CourseInfo() {
// to be compatible with previous version
private var programmingLanguageVersion: String? = null

override var icon: Icon?
@Transient
get() = this.toCourse().logo
set(_) {}

constructor(location: String = "", course: Course, tasksTotal: Int = 0, tasksSolved: Int = 0) : this() {
this.type = course.itemType
id = course.id
Expand Down
Loading