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
Add ProjectRun and ProjectRunList commands #354
Conversation
Nice! I'd love to get this merged! Let me know if I can help in anyway. (finally ditched IntelliJ for vim today, and this is the last feature I need!) |
@@ -138,6 +138,7 @@ target(name: 'init'){ | |||
include(name: 'dropins/**/plugins/org.eclipse.*.jar') | |||
include(name: 'plugins/javax.*.jar') | |||
include(name: 'plugins/org.eclipse.*.jar') | |||
include(name: 'plugins/org.eclipse.debug.*.jar') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, why was this added? plugins/org.ecilpse.*.jar
would match org.eclipse.debug.*.jar
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, it was added by #177 and I guess I didn't notice it there. I'll remove this line when I merge this in.
After playing around with this, I think one of the follow would need to happen:
When I run a non-gui app from a headless instance of eclipse, aside from examining my system's process list, I have no idea what's happening with that process. So, I think releasing this feature as is would result in a lot of confusion, questions, and bug reports by users if they attempted to run a non-gui project from a headless eclimd. |
I see, that makes sense. I've been looking into this with Android in mind, and it might be a special IProcess[] procs = launch.getProcesses();
if (procs.length > 0) {
procs[0].getStreamsProxy().getOutputStreamMonitor()
} and possibly redirect that to a file and handle output that way (or, use I think for me the coolest workflow with non-gui projects would be:
Thoughts? On Sun, Oct 19, 2014 at 12:05 PM, Eric Van Dewoestine <
|
On 2014-10-19 12:14:12, Daniel Leong wrote:
I'm fine with using vim remote calls for now. Check out the new
I'm not sure off hand, but you could create a simple class which
I'm fine with the initial version just assuming that the user is using Fyi that all commands coming from vim do already set the '--editor'
... but like I said, I have no issues with this feature assuming the
I wouldn't spend extra time on that. If they don't have remote support
This all sounds good to me. eric |
Awesome! I'll check it out when I find some free time On Mon, Oct 20, 2014 at 11:05 AM, Eric Van Dewoestine <
|
If async execution is not possible, it tries to fallback on synchronous execution. However, it will now terminate the launch and return an error if that execution spawned long-lived processes. For example, running an Android project does not leave any processes behind, so it can be run synchronously even if the vim used doesn't have remote-send support. Still TODO: tracking the launches, opening the output buffer, handling process death (IE: it dies on its own) and terminating processes. Perhaps I'm missing something, but I can't seem to find a way to hook into the IProcess's life cycle....
24976b8
to
e86493e
Compare
Note: Rebased off master to get
Still working on the async output buffer stuff, but does this sound like a decent way to handle it? |
On 2014-10-21 16:31:11, Daniel Leong wrote:
How does it decide what is long-lived or not? Does it rely on waiting
I'd probably still recommend aborting right away on the vim side if eric |
It is perhaps a hack, but for these purposes "long-lived" simply means "has
You would think so, but the vim that comes with OSX by default does not. I don't have any strong objections to requiring remote-send from the vim |
Now just need to be able to terminate it manually
On 2014-10-21 18:24:29, Daniel Leong wrote:
So it sounds like with this solution, if another user on OSX comes Perhaps the correct solution is to fix VimClient to send the remote eric |
It should kill it and provide a meaningful error to the user. If there is I considered this approach but couldn't immediately find a way for vim to On Wed, Oct 22, 2014 at 10:41 AM, Eric Van Dewoestine <
|
On 2014-10-22 07:55:10, Daniel Leong wrote:
An error message will help, but it would still seem odd that it fails
|
If we fix the vim executable thing with your fix below, then this would
Awesome! :) I'll give these a shot |
Phew. I thought MacVim didn't have |
I believe everything is implemented as spec'd. Let me know if my handling of missing remote-send is still unsatisfactory and I'll add a client-side check. |
I finally got around to testing this again and I have some more comments:
Aside from these issues it seems to be working great! |
|
Yeah, that's a much simpler solution and the user is only a |
Also, increases the timeout to be more lenient; we assume such a thing would not need to be used interactively....
I believe that covers everything! The NPE was caused by the remove expression execution timing out. I handled this case more explicitly to provide a clearer error message and increased the timeout to make it more reliable. |
update the project run messaging to be more clear that vim needs to be run in server mode. refs #354
previous behavior was to rename the output window when the program terminated, then on subsequent run, look for that window, delete the buffer then create a new output window. this caused problems, at least using console vim on linux, where the buffer deletion would not be immediate since it occured from a remote command call. this resulted in the server side failing to capture the output buffer number and raising an exception. There may very well have been some error other error on the vim side not being exposed, but it seemed to be easier to just re-use the window. If the program status needs to be re-added later, that can go into the statusline instead to avoid buffer name issues. refs #354
As you've probably noticed I've created a branch and have been addressing various little issues during my testing. I also started to create a unit test for So I have a simple
When I go to run the project containing this file I may or may not see those 2 lines of output. This seems to be do to a race condition in the code in that the out/err listeners are attached to the process after it is already running, so it becomes a crapshoot as to whether those listeners will be added before the program has already written to out or err or not. I haven't dug into the eclipse launch api extensively yet, so I'm not sure how to solve this problem. Two potential solutions that have come to mind, but that I'm not sure how feasible they are:
I was all set to write the unit tests, add some docs and merge this in, but I think this issue is a show stopper. I know your main motivation for this feature is to run android apps, so if the additional overhead of writing a custom console (or whatever other solution to accommodate this) proves to be way more work than I'm sure you anticipated at the onset, an alternative to this feature request could be one specifically for Any input from other users monitoring this feature request are welcome as well. |
Note: not yet passing (may pass occasionally in theory), do to a race condition due to std out/err stream listeners not being added to the processes until after they have started, at which point they may have already written to those streams. refs #354
Sorry for the delay. I've been pretty busy at work and haven't been able to sit down at the AndroidXml ticket yet, either. It's still on my TODO though! Hmm. Very good points. I don't know why, but I guess I assumed the output was buffered and that the listener would do the "right thing." I was hoping to attach a console to get the actual outputs of the build itself, but was having trouble finding a place to do that. I'll start looking into that again when I get a chance. I'm using a Handling user input for stdin would definitely be a huge feature and is probably beyond the scope of this PR. Sure, we could add a split like the I agree that missing output should be a showstopper and will look into it ASAP, but I think the feature is useful enough without blocking it on stdin support. |
Hello! It's been a while but I finally sat down and looked at this. The Let me know what you think, and whether providing input is required. If so, how do you feel about my proposal for |
Unfortunately, the race condition has only been diminished, not elminated. When I manually run my test program I'll now see my output probably 90+% of the time, which is much better than before, but still potentially frustrating for the user. I can easily force the output to be lost 100% of the time by adding a sleep just before the listeners are added, so the streams are still competing to be added before the processes start up. |
From the code comments: // By default, ProcessConsoleManager will attach a ProcessConsole // that will steal any buffered output. Rude. Let's muzzle it // for a second while we launch so it won't steal our output
Okay! After spending some time combing through eclipse source, it turns out the This process is triggered by the Theoretically there's a race potential where you would launch something from eclipse gui while also launching something from vim, which would result in not getting your UI console... but this seems unlikely. If we really need to support that, we could attach a temporary listener that delegates to the |
Getting very close, but I still lose the output on the very first project run per eclimd start.
I was testing going back and forth between the gui as well:
But if after startup I run from vim first, then just like the headless version, the first run loses all output.
|
That's odd—I cannot reproduce this at all. Even re-introducing the sleep before attaching listeners, I did not lose output for the first run in vim either from headless or gui. The only thing I can think of would be that the |
I'm using:
for what it's worth |
also remove a little left over cruft. refs #354
- fix :Terminate command in output buffer by setting b:eclim_project - update TerminateAllLaunches to handle the current buffer not being in a project. refs #354
I finally got a chance this morning to dig into this and I was able to resolve the issue and get this merged in. Thank you very much for the contribution and for your patience. |
Since #177 seems to be abandoned, this is my attempt at picking up where he left off.
:ProjectRun
will execute the first-found launch config for the current project:ProjectRunList
will list all launch configs and their type for the current projectI've only used this with Android projects, but I think works very well. For other projects that run in a console inside of Eclipse, it may be possible to hook into the
ILaunch
to dump output, terminate launches, etc. Not sure if that is necessary for this PR or not.The commands work well in both headless mode and headed.