我一直在遵循官方 jetbrains 页面的本指南,直到第 2 步出现。
在该页面提到的图片中,有很多选项,如 ssh、wsl、vagrant、docker 等。在我的 pycharm(最新 2019.3.4)中,它只显示 4 个选项 - venv、conda、pipenv 和 system-interpreter。
添加 python 解释器对话框中没有 WSL 菜单。
见下图:
在网上搜索了一个小时,没有找到显示如何修复它的结果。如果有外部插件可以这样做,我会在 PyCharm 中开始插件搜索,但是没有名为 WSL 的插件。
我不知道如何设置 WSL 解释器,我现在在我的 wsl 上安装了 python3.8。
任何帮助将不胜感激!
python jetbrains-ide pycharm python-3.x windows-subsystem-for-linux
我需要调用一个内部的悬吊功能suspendCoroutine块,我打电话之前continuation.resume()。这样做的合适方法是什么?
private suspend fun someFunction() = suspendCoroutine { cont ->
//...
val myResult = mySuspendingFunction() //<--- The IDE says "Suspension functions can be called only within coroutine body"
cont.resume(myResult)
}
Run Code Online (Sandbox Code Playgroud) 我正在使用 Intellij Idea 的 Kotlin REPL。
当我输入这个时:
println("line 1 ")
println("line 2 ")
print("same ")
print("line")
Run Code Online (Sandbox Code Playgroud)
我希望这个输出:
"line 1 "
"line 2 "
"same line"
Run Code Online (Sandbox Code Playgroud)
但相反,我得到:
"line 1 line 2 same line"
Run Code Online (Sandbox Code Playgroud)
为什么?
这是一个代码,我很难理解为什么第一个编译而第二个不编译?
class Test11<T : Number> {
lateinit var test: MutableList<out T>.() -> Unit
}
fun main() {
val test: Test11<Int> = Test11<Int>()
val test2: Test11<out Number> = test
test.test.invoke(MutableList(3) { 55 }) // First
test2.test.invoke(MutableList(3) { 55 }) // Second
}
Run Code Online (Sandbox Code Playgroud)
第二个说MutableList<Nothing>是预料之中。
所以基本上在第一种情况下,T => Int所以out T => out Int => out Number也许。在第二种情况下,T => out Number任何是 Number 的子类,那么仍然out T => out Number正确吗?
我无法理解为什么它不能按这种逻辑工作......
我有命令提示符 (cmd),即使我转到 Intellij 中的相同路径,它也会显示所有内容,但在 Intellij 中java命令和JAVA_HOME环境变量未设置。
我已经在系统和用户设置中设置了环境变量(Win 10)
这是 intellij 终端的输出:
D:\IdeaProjects\(Project)>java -version
'java' is not recognized as an internal or external command,
operable program or batch file.
D:\IdeaProjects\AirbentPluginIF>gradlew dokka
ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.
Run Code Online (Sandbox Code Playgroud)
而cmd的输出:
D:\IdeaProjects\AirbentPluginIF>java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS) …Run Code Online (Sandbox Code Playgroud) val a: Int = 100
val boxedA: Int? = a
val anotherBoxedA: Int? = a
val b: Int = 10000
val boxedB: Int? = b
val anotherBoxedB: Int? = b
println(boxedA === anotherBoxedA) // true
println(boxedB === anotherBoxedB) // false
Run Code Online (Sandbox Code Playgroud)
boexA === andotherBoxedA我不明白的是和之间有什么区别boexB === andotherBoxedB
更令人困惑的是,当更改 b t0 100 时,输出为 true true
val a: Int = 100
val boxedA: Int? = a
val anotherBoxedA: Int? = a
val b: Int = 100
val boxedB: Int? = b
val …Run Code Online (Sandbox Code Playgroud) 
我从 NavigationAdvancedSample 复制了 NavigationExtensions.kt 扩展文件,我得到了这个异常: