Maximus5 / ConEmu

Customizable Windows terminal with tabs, splits, quake-style, hotkeys and more
https://conemu.github.io/
BSD 3-Clause "New" or "Revised" License
8.57k stars 572 forks source link

Integration with WebStorm (JetBrains) to replace its Terminal #153

Open afilp opened 9 years ago

afilp commented 9 years ago

Currently, you can replace Terminal inside WebStorm with any console. So, I did replace it with the powerful ConEmu. However, this only means that ConEmu opens as a window outside of WebStorm, with the folder set to the project.

This is not a good integration because every time I hit "Alt-F12" (WebStorm's shortcut) to go into the "Terminal", the ConEmu window does not get the focus.

It would be nice if it could be "embedded" at the Terminal position of WebStorm (I understand that this requires work from WebStorm rather than ConEmu, but I am not sure if your software is easily "embeddable" within another).

image

image

Maximus5 commented 9 years ago

ConEmu is able to embed anywhere. However docs page is not fully translated yet. http://conemu.github.io/en/InsideParent.html

devmondo commented 9 years ago

does not work :(

Maximus5 commented 9 years ago

@devmondo what?

devmondo commented 9 years ago

i added - inside param, so now conemu dont show at all, if remove it , i still get conemu in separate window like above

yguedidi commented 9 years ago

:+1:

bjornreppen commented 9 years ago

:+1:

fnagel commented 8 years ago

Same here. I would love to use conemu in phpstorm. Any advise?

mdesign83 commented 8 years ago

+1 embedded conemu

Maximus5 commented 8 years ago

Wrong place to ask! Fill a request to WebStorm authors. ConEmu can be easily run embedded as I've said before.

tyler36 commented 8 years ago

@Maximus5 I tried changing the terminal command to "ConEmu64.exe -inside" I get an error "Can't find appropriate parent window. Continue in normal mode?"

Click "yes" and I get a new CMD window (not embedded). Click "no" and I get a "fast configuration" popup, that appears to do nothing when closed.

I tried changing the terminal command to "ConEmu64.exe -insidepid 1632". 1632 was found inside task manager. I get an error "Can't find appropriate shell window! Unrecognised layout of the Explorer. Continue in normal mode?". Same options with same results.

I am unsure how to check for the HWND as listed on your first link "-insidewnd 0xHWND"

Is there something I am doing wrong?

Maximus5 commented 8 years ago

@tyler36 Are you WebStorm author? Have you prepared WebStorm to start ConEmu embeddable? I do not think so.

All required information exists in docs, I've posted above.

In brief, obviously, the switch -insidepid that was developed for Explorer would never work in WebStorm. And if you do not provide exact child window descriptor that ConEmu may utilize for covering its whole area, embedding feature would not be working.

Anyway, I can't understand why anyone has problems with ConEmu as external terminal. ConEmu able to bring it to top automatically.

Maximus5 commented 8 years ago

Just have installed and checked WebStorm.

Verdict

Without support from WS authors you'll never get neat terminal integration.

TechInfo

WS has only one (main) HWND, no children windows for layout/panes. So ConEmu has no chance to acquire proper coordinates of the area it have to cover. Even if you specify the coordinates if the area, you would get various glitches like two blinking carets or weird behavior of WS' terminal pane resizing.

Contact JetBrains!

afilp commented 8 years ago

FYI, I had already created an issue at JetBrains, back in May 2015:

https://youtrack.jetbrains.com/issue/IDEA-140298

Please vote for it (and/or comment there). Thanks.

mdesign83 commented 8 years ago

@af7 thank you for the link, I voted

afilp commented 8 years ago

@Maximus5 My only problem with ConEmu being external to WebStorm is that I cannot switch to Terminal with the "Alt-F12" keyboard shortcut (once it is already open), as described in my original post here:

"every time I hit "Alt-F12" (WebStorm's shortcut) to go into the "Terminal", the ConEmu window does not get the focus."

I also cannot "hide" the Terminal view (in other words return to my WebStorm code view) with "SHIFT-ESC", while I am on ConEmu. This is reasonable though (since "SHIFT-ESC" would be triggered inside the external ConEmu, NOT WebStorm), so I could just do "Alt-Tab" and return to WebStorm (I would prefer the "SHIFT-ESC" obviously, if it is possible for ConEmu to know that it "originated" from a WebStorm process and give it the focus). But once I switch to WebStorm with the "Alt Tab" then I still need to press "SHIFT-ESC" because the focus remains on the Terminal (due to the previous "Alt-F12"), and not to the code view.

I understand that this problem may need to be solved by WebStorm, rather than ConEmu, if ConEmu remains external. WebStorm needs to treat "Alt-F12" differently when an external terminal is used. I believe that it should not open the small Terminal view at the bottom and give it focus but rather trigger the "re-focus" of the external ConEmu instance that was opened by the initial "Alt-F12". If this is implemented, then doing "Alt-Tab" from the ConEmu window will get us again inside the "Code View" of WebStorm (or where we were before), so the switching process will be fast.

Does this make sense at all?

stubobis1 commented 8 years ago

@Maximus5 is there any update with this?

Maximus5 commented 8 years ago

Please ask there: https://youtrack.jetbrains.com/issue/IDEA-140298

fralik commented 5 years ago

I looked at it a bit further. @afilp wanted to use shortcuts. Terminal hiding (Shift+Esp) is possible only if terminal window is docked. However, one can undock the window, then it is possible to get its HWND and attach conemu to it. My findings:

  1. Docked terminal window doesn't expose it's HWND. It is perhaps possible to get it somehow, but this would involve an external app.
  2. Every time you press Alt-F12, a new HWND is generated. Thus it is not possible to start conemu easily. Again, I can think of an additional app, which could monitor the state and figure out HWND, but I do not think it is much sense in it.
  3. After attaching conemu to undocked terminal window Alt-F12 brings focus to the window, but not to the conemu. This means one can not hit Alt-F12 and start typing in conemu. One has to click on the terminal first. Actually what happens before you click on conemu window, is that input goes to the underlying original terminal!

However, knowing that it is possible to embed cmder, which in fact is based on ConEmu, it shall be possible to embed ConEmu directly.

xak2000 commented 4 years ago

I found a workaround for this issue that at least makes default cmd.exe terminal usable in IDEA (IDEA is older sister of WebStorm).

With this configuration it at least have useful prompt, colors and what is most important for me - Clink capabilities, that means CTRL-D works, UP and DOWN works and takes into account what I already entered (so, if I entered kube and press UP, it will cycle though history of only those commands, that starts with kube) etc.

I just can't imagine a life without Clink in Windows terminal now. And this way it works inside IDEA too!

Run internal Terminal in IDEA with cmd.exe, Clink and ConEmu

Open Settings -> Tools -> Terminal and change Shell path field value to:

"cmd.exe" /k ""c:\Program Files\ConEmu\ConEmu\CmdInit.cmd" && "c:\Program Files\ConEmu\ConEmu\clink\clink_x64.exe" inject"

The most hard part was to correctly arrange the quotes... Oh, Windows...

Enable ANSI Escape sequences by default in Windows 10

This makes IDEA to properly display colorful output of tools like jq.

Add or update this key in the Windows Registry (regedit):

[HKEY_CURRENT_USER\Console]
"VirtualTerminalLevel"=dword:00000001