Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to 232 and fix REPL #253

Merged
merged 2 commits into from
Oct 11, 2023
Merged
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
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
version=SNAPSHOT
#ideaVersion=IC-202-EAP-SNAPSHOT
ideaVersion=PC-231-EAP-SNAPSHOT
pythonPlugin=PythonCore:231.8109.144
ideaVersion=PC-232-EAP-SNAPSHOT
pythonPlugin=PythonCore:232.9921.47
publishToken=token
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.jetbrains.micropython.settings.MicroPythonFacet
import com.jetbrains.micropython.settings.microPythonFacet
import com.pty4j.PtyProcess
import org.jetbrains.plugins.terminal.LocalTerminalDirectRunner
import org.jetbrains.plugins.terminal.TerminalProcessOptions
import org.jetbrains.plugins.terminal.ShellStartupOptions

interface CommsEventListener {
fun onProcessStarted(ttyConnector: TtyConnector)
Expand Down Expand Up @@ -45,13 +45,15 @@ class MicroPythonReplManager(module: Module) {
return
}

val initialShellCommand = mutableListOf(
facet.pythonPath!!,
"${MicroPythonFacet.scriptsPath}/microrepl.py",
devicePath
)

val terminalRunner = object : LocalTerminalDirectRunner(currentModule.project) {
override fun getInitialCommand(envs: MutableMap<String, String>): MutableList<String> {
return mutableListOf(
facet.pythonPath!!,
"${MicroPythonFacet.scriptsPath}/microrepl.py",
devicePath
)
return initialShellCommand
}

fun getTtyConnector(process: PtyProcess): TtyConnector {
Expand All @@ -60,8 +62,11 @@ class MicroPythonReplManager(module: Module) {
}

synchronized(this) {
val terminalOptions = TerminalProcessOptions(null, null, null)
val process = terminalRunner.createProcess(terminalOptions, null)
val terminalOptions = ShellStartupOptions.Builder()
.workingDirectory(devicePath)
.shellCommand(initialShellCommand)
.build()
val process = terminalRunner.createProcess(terminalOptions)
val ttyConnector = terminalRunner.getTtyConnector(process)

currentProcess = process
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<depends>com.intellij.modules.python</depends>
<depends>org.jetbrains.plugins.terminal</depends>

<idea-version since-build="231"/>
<idea-version since-build="232"/>

<extensionPoints>
<extensionPoint qualifiedName="com.jetbrains.micropython.deviceProvider"
Expand Down