-
Notifications
You must be signed in to change notification settings - Fork 128
Add support for launching Eclipse Process in a system terminal session #1762
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
base: master
Are you sure you want to change the base?
Conversation
55005b3
to
727aafd
Compare
Currently if I start gogo-shell with jlink support from within eclipse I get this:
with this enabled one gets as one can see the eclipse console does not understand all terminal commands but the ANSI coloring already works and the process runs in a native terminal session. |
If I replace the standard Eclipse Console with jediterm it looks like this: so colors and auto complete is supported. |
CDT has a full featured terminal included https://github.com/eclipse-cdt/cdt/tree/main/terminal . It's worth taking a look at it (maybe even reusing parts of it). |
Test Results 1 758 files ±0 1 758 suites ±0 1h 28m 37s ⏱️ - 3m 58s For more details on these failures and errors, see this check. Results for commit 48b962b. ± Comparison against base commit 64136ca. ♻️ This comment has been updated with latest results. |
As far as I understand this provides a new view with a terminal where I then can launch some process but it does not integrates with default launches / console views. I think this would be useful for the console view, lets see if it can be used here... |
BTW I now installed the plugin but it complains |
TM Terminal's control is designed to be embedded in any layout - CDT uses it to provide a terminal interface to GDB for example. TM Terminal's view also uses the control. jediterm is interesting, it seems more maintained the TM terminal, but I don't know much else. Note that the "pure Java terminal widget" does not extend to support PTY which relies on native code (or JNA for ConPTY). The native code (https://github.com/JetBrains/pty4j) is a fork of org.eclipse.cdt.core.native.
If you can explain how to reproduce, please share. The terminal uses org.eclipse.cdt.core.native code to create and manage PTY and subprocesses. If you download any of the EPP packages you can open a terminal to see it there - I am curious if your manual install indicates some dependency/configuration error: (Note if you are Windows on ARM support was added in CDT 12 being released with 2025-03)
This is expected behaviour if native part of PTY support doesn't load |
@jonahgraham many thanks for the details I'll try to take a deeper look into that, I just tried yesterday to use the UI part standalone but not with much success, the GDB example looks really handy as a starting point! While jediterm seem to work quite well the main problem is that is is using Swing, so an SWT alternative would be of course useful, I'm not sure how easy it would be to rewrite only that part. One thing that currently hinders a smooth integration is that the Console actually want a ConsoleViewer (what is a SourceViewer) with an |
I now got it working by open a separate shell and redirecting the streams with some hacking into the debug-plugin: Peek.2025-03-08.07-10.mp4so far it looks very promising and basic operations work. So question would be to how proceed here, I could think about having the new API here and let CDT do provide the integration I assume this would then be ProcessFactory. Or we go further with pty4j) as it is quite standalone but if CDT can offer similar I would better integrate this. One drawback is that CDT terminal is not part of platform SDK (@merks ?) so one needs to install it extra for this case. Another thing is then UI that seems a bit more challenging as we would require a lot more integration points but maybe I just have not found the right place yet. In general I wonder if it would be useful to bring the console support into platform (maybe as a separate repo) so it could be more tightly integrate. |
I now found out that I need to explicitly add
to my launch configuration, now it also works in my debugged application. |
727aafd
to
fb1e394
Compare
I now got it basically working with CDT native (updated the PR here) as well there are just two issue:
|
I now was able to show the CDT terminal as a console for the running java process: Peek.2025-03-08.10-30.mp4 |
df14172
to
25fcf45
Compare
I now have all puzzle pieces and a fully working solution for terminal support using CDT native, I'll try to create smaller PRs. @jonahgraham @akurtakov it CDT using "ibuilds" or would one need to wait for the next release to use such new extension points there? |
very interesting. i would like to have! |
@jonahgraham I think actually a tight integration in platform by default would be beneficial. I therefore wonder if we can maybe merge some of the core terminal parts into platform to be provided from there? This is mainly this bundle here: https://github.com/eclipse-cdt/cdt/tree/main/core/org.eclipse.cdt.core.native + the native fragments, but also the terminal emulation would be interesting. As an alternative we might consume some dedicated bundles from CDT through the target platform, but this would add yet another inter dependency here. |
Currently processes are launched as a forked process without a terminal session attached to them. Some features of processes require a terminal session (e.g. autocompletion) and currently not work when running from within eclipse (e.g. the gogo-shell). This is an attempt to bring terminal session support to Eclipse to support real terminal application similar to what is supported by IntelliJ.
25fcf45
to
48b962b
Compare
Yes. That is a good idea. The cdt project adopted the terminal from the tm project to keep it alive(ish) and building. Cdt was a logical home because of the dependency on cdt core native + serial bundle. But we could move all those bundles to the platform. |
@akurtakov I wonder what would be the best place to move it to. Should we use |
Would you please elaborate on the Program class support a bit more? If SWT is to use it it would should prevent yet another circular dependency at build time. |
First the code for creating a pty is independent from anything else (thus could be part of SWT) so there is no risk for a circular dependency. Second we already have native code in SWT and a build infrastructure, and starting a command in a terminal-session looks similar to starting an external process with the TTY (e.g. |
So the proposal is to have extra bundles in swt repo or merge into current SWT bundle/fragments? I am kind of torn here - from one side I don't want to complicate swt build more (maybe it would not at all if in same bundle fragments) on the other replicating the builds in another repo is a problem too and third thing is that this is not strictly UI toolkit thing. Do you care to propose a draft PR for SWT so we can see what would it look like? |
I don't think its worth an extra bundle as it does not imply any dependencies. Also I hardly can imagine this to be useful without an UI anyways. I'll try to create a PR to see how it would fit in SWT. |
@jonahgraham I noticed that there is an (optional) dependency for |
@akurtakov I created a rough PR here that shows how it would look like to merge it into SWT: |
conpty is the new way of handing consoles on Windows. winpty is the old way. This is what I recently said in eclipse-cdt/cdt#969 (comment) - and now I think is the time to be braver and remove winpty entirely:
Some additional context and links of use for conpty can be found in N&N for CDT https://github.com/eclipse-cdt/cdt/blob/main/NewAndNoteworthy/CDT-10.6.md#windows-pseudo-console-conpty-the-default |
Currently processes are launched as a forked process without a terminal session attached to them. Some features of processes require a terminal session (e.g. autocompletion) and currently not work when running from within eclipse (e.g. the gogo-shell).
This is an attempt to bring terminal session support to Eclipse to support real terminal application similar to what is supported by IntelliJ.