@@ -7,6 +7,18 @@ import com.intellij.openapi.util.SystemInfo
77import com.intellij.platform.lsp.api.LspServerSupportProvider
88
99
10+ // https://stackoverflow.com/q/79750919
11+ /* *
12+ * Loads the class [C].
13+ *
14+ * This (inline) function is necessary because
15+ * a plain reference would otherwise be optimized away.
16+ */
17+ private inline fun <reified C > load () {
18+ C ::class .qualifiedName
19+ }
20+
21+
1022/* *
1123 * Whether LSP4IJ is both installed and enabled.
1224 */
@@ -21,13 +33,12 @@ internal val lsp4ijIsAvailable: Boolean
2133 * Whether the native client is available.
2234 *
2335 * According to [the docs](https://plugins.jetbrains.com/docs/intellij/language-server-protocol.html#supported-ides),
24- * it is part of IntelliJ IDEA Ultimate, WebStorm, PhpStorm, PyCharm Professional ,
36+ * it is part of IntelliJ IDEA Ultimate, WebStorm, PhpStorm, Unified PyCharm ,
2537 * DataSpell, RubyMine, CLion, Aqua, DataGrip, GoLand, Rider, and RustRover.
2638 */
27- @Suppress(" UnusedExpression" )
2839internal val lspIsAvailable by lazy {
2940 try {
30- LspServerSupportProvider
41+ load< LspServerSupportProvider >()
3142 true
3243 } catch (_: NoClassDefFoundError ) {
3344 false
@@ -38,10 +49,9 @@ internal val lspIsAvailable by lazy {
3849/* *
3950 * Whether the IDE has WSL-specific support.
4051 */
41- @Suppress(" UNUSED_EXPRESSION" )
4252internal val wslIsSupported by lazy {
4353 SystemInfo .isWindows && try {
44- WslTargetEnvironmentConfiguration :: class
54+ load< WslTargetEnvironmentConfiguration >()
4555 true
4656 } catch (_: NoClassDefFoundError ) {
4757 false
0 commit comments