withfig / fig

Public issue tracker for Fig.
https://fig.io
MIT License
2.06k stars 63 forks source link

Integration with Jetbrains IDEs #49

Closed nmolham-godaddy closed 2 years ago

nmolham-godaddy commented 3 years ago

Enable Fig autocomplete in JetBrains IDEs' integrated terminal

JetBrains IDEs

Are we missing one that you use? Comment below!


Original Issue Is your feature request related to a problem? Please describe. It's just going to make it a really solid solution to make fig integrates with PhpStorm internal terminal window

Describe the solution you'd like PhpStorm is currently the top pick for PHP developers which offers many features (AIO) which for the most part allows you to do all within the IDE without the need to use external programs (ex: Git, Terminal, etc)

So if Fig is able work well with the IDE's internal terminal window. it will make a big difference.

Describe alternatives you've considered The current alternative is to keep 2 windows open, one for the IDE and other for the terminal (iTerm2)

Additional context I am not sure if this is the place for it, but the support for the IDE + composer + npm is a killer combo

Thanks for the amazing work

mschrage commented 3 years ago

Thanks for creating the issue! We definitely want to add support for for Jetbrains IDEs.

Whether this is possible comes down to how much they expose with their extension API + to the macOS accessibility API.

In order to build out the integration, we need to...

  1. Locate bounding rect of cursor
  2. Determine when user is typing into a terminal versus the editor
  3. If the IDE allows multiple terminal windows/tabs to be created, determine when the user changes keyboard focus between them

Let me know if you have any thoughts :)

adam-code-labx commented 3 years ago

Hey @mattschrage I am not a java developer, worked with almost every other language except java. However this could be an interesting plugin for us to understand how to interact with the built in terminal? https://github.com/anthraxx/intellij-awesome-console (At least it doesn't look as complicated as objective-c πŸ˜†)

mschrage commented 3 years ago

Thanks for the suggestion @adam-code-labx! I've looked into the extensions API and it's not clear that it provides the information we need. I plan on investigating further soon!

geenva commented 3 years ago

IntelliJ IDEA, please!

PsyGik commented 3 years ago

I wanna say Android Studio as well. But since Android Studio is loosely based on JetBrains' IntelliJ IDEA software, I suppose starting with JetBrains' products first makes sense to me. Would love to discuss more!

olivernybroe commented 3 years ago

Hi, I have done multiple plugins for IntelliJ, and just so everyone are aware, by them creating a plugin it will work for all IntelliJ products, including Android Studio.

@mschrage What specifically is it you guys are looking for in the API? Like what do you need to build an integration?

mschrage commented 3 years ago

To work with any Jetbrains IDE, we need to somehow get notifications when:

  1. The embedded terminal is opened / closed
  2. A new terminal tab is opened
  3. A user switches terminal tabs / some unique identifier for knowing which terminal tab is currently open
  4. The embedded terminal becomes focused
  5. The embedded terminal loses focus

@olivernybroe did some research into this:

Yeah the IntelliJ API is massive and can be pretty overwhelming. So the terminal which you guys wanna build into is actually a plugin on IntelliJ. https://github.com/JetBrains/intellij-community/tree/master/plugins/terminal So the terminal plugin registers 3 first-party extension points. - https://github.com/JetBrains/intellij-community/blob/master/plugins/terminal/src/org/jetbrains/plugins/terminal/LocalTerminalCustomizer.java - https://github.com/JetBrains/intellij-community/blob/master/platform/execution-impl/src/com/intellij/terminal/TerminalShellCommandHandler.kt - https://github.com/JetBrains/intellij-community/blob/master/plugins/terminal/src/org/jetbrains/plugins/terminal/ui/OpenPredefinedTerminalActionProvider.kt However looking at these 3 extension points, they don't really give you the information you need. By looking into the class, what it seems like you would need is to get the TerminalView from the project services, run TerminalView#getWidgets and on each of them you can add a listener of the type JBTerminalWidgetListener https://github.com/JetBrains/intellij-community/blob/master/plugins/terminal/src/org/jetbrains/plugins/terminal/TerminalView.java https://github.com/JetBrains/intellij-community/blob/master/platform/execution-impl/src/com/intellij/terminal/JBTerminalWidgetListener.java If you take a look at the JBTerminalWidgetListener it has a lot of the information you need.
sametcelikbicak commented 3 years ago

Thanks for this issue, also it would be great to support JetBrains Rider IDE terminal

panckreous commented 3 years ago

RubyMine and AppCode as well would be divine

sztelzer commented 3 years ago

Please add JetBrains GoLand to this list. There is always multiple terminals open near a Go project.

kylegrieder commented 3 years ago

Yes, I'll second GoLand as well. I use this daily, as well as WebStorm.

mschrage commented 3 years ago

Just updated the list to include GoLand, AppCode, RubyMine and RiderIDE!

We've made some good progress on Terminal integrations in the last sprint and I'm pretty optimistic that we'll be able to get Fig working in JetBrains IDEs soon!

sametcelikbicak commented 3 years ago

Just updated the list to include GoLand, AppCode, RubyMine and RiderIDE!

We've made some good progress on Terminal integrations in the last sprint and I'm pretty optimistic that we'll be able to get Fig working in JetBrains IDEs soon!

That's great news, I'm so excited with new release which is support JetBrains IDEs.

akashshyamdev commented 3 years ago

That's great πŸ‘

marggx commented 3 years ago

Any news on this ?

mschrage commented 3 years ago

@marggx this is one of our goals for the month!

SeongwoonHong commented 3 years ago

Looking forward to have this 😁

nmolham-godaddy commented 2 years ago

@mschrage thanks for the hard work, looking forward PhpStorm support

ronanwp commented 2 years ago

It would be great to have this in GoLand as well. Thank you!

bvitaliyg commented 2 years ago

I think we may need to consider treating Android Studio requests as a part of this ticket as it uses the same engine.

mschrage commented 2 years ago

Sorry for the delay on this. We launched decided to focus on stability after the public launch.

The core technical difficulties of integrating with JetBrains IDEs have been figured out -- it is definitely possible! -- but we still need to write the actual integration.

sametcelikbicak commented 2 years ago

Sorry for the delay on this. We launched decided to focus on stability after the public launch.

The core technical difficulties of integrating with JetBrains IDEs have been figured out -- it is definitely possible! -- but we still need to write the actual integration.

Great news, JetBrains IDE support coming soon, I can't wait πŸ‘

mschrage commented 2 years ago

Plugins can be automatically installed by moving them to the plugins folder of IDE. See: https://intellij-support.jetbrains.com/hc/en-us/articles/206544519

kylegrieder commented 2 years ago

Seeing this comment last night got me hopeful that this is almost ready... πŸ‘€

mschrage commented 2 years ago

JediTerm runs a shells with custom rc files before sourcing the user's. See https://github.com/JetBrains/intellij-community/tree/master/plugins/terminal/resources

mschrage commented 2 years ago

If you are interested in getting Fig to work in your favorite JetBrains IDE, would you please run osascript -e 'id of app "NAME OF IDE" and share the output here?

There is a special Christmas present in the works! πŸŽ„πŸŽ

koppieesq commented 2 years ago

Yay!! Here's the output for a few JetBrains IDEs:

WebStorm: com.jetbrains.WebStorm GoLand: com.jetbrains.goland (notice the capitalization scheme varies!) PhpStorm: com.jetbrains.PhpStorm PyCharm: com.jetbrains.pycharm

Thanks in advance for all your hard work - I can't wait to see it in action!

bvitaliyg commented 2 years ago

Note that the output is different when the app was installed using Jetbrains Toolbox: Android Studio: com.jetbrains.toolbox.linkapp.pcom.jetbrains.toolbox__ndroid_tudio_rctic_ox_2020_3_1_atch_4 GoLand: com.jetbrains.toolbox.linkapp.pcom.jetbrains.toolbox__o_and_2021_3_1 PhpStorm: com.jetbrains.toolbox.linkapp.pcom.jetbrains.toolbox__hp_torm_2021_3 RubyMine: com.jetbrains.toolbox.linkapp.pcom.jetbrains.toolbox__uby_ine_2021_3

duboiss commented 2 years ago

PHPStorm: com.jetbrains.PhpStorm DataGrip: com.jetbrains.datagrip

For DataGrip, Terminal plugin is not install by default but I'm pretty sure some users install it.

mschrage commented 2 years ago

Still some kinks to be ironed out, but....

Screen Shot 2022-01-07 at 5 39 49 PM
marggx commented 2 years ago

Is there a build for phpstorm i can test out?

etcook commented 2 years ago

Would love to see IntelliJ support

mschrage commented 2 years ago

@marggx not yet!

@etcook it is coming - I promise!

pronovaso commented 2 years ago

Hi. Is normal, if combination of Webstorm + ZSH shell not work together?

mschrage commented 2 years ago

@pronovaso yes, currently Webstorm is not yet supported.

pszalko commented 2 years ago

Looking forward for phpStorm support! πŸ”₯

pvds commented 2 years ago

@mschrage would love to test the pre-release version to get the kinks out!

@pronovaso Fig doesn't work the same as 'normal' Zsh plugins (by adding them in your .zshrc). It only adds environment variables in .zshrc.

This has the advantage of not slowing down your terminal (as much?) and by using OS accessibility permissions for extra functionality but the disadvantage that it doesn't work 'out-of-the-box' in any app running Zsh.

thisisthekap commented 2 years ago

What do I have to do to give the Rider integration a try?

mschrage commented 2 years ago

You no longer need to be on a beta version of Fig to get access to autocomplete inside of Jetbrain's IDEs. However, currently the integration is a bit tricky to setup which is why it is hidden by default.

Instructions for those who are brave enough to attempt it:

  1. Run fig settings integrations.experimental true and then restart the Fig app
  2. Click the Fig menubar icon > Integrations > $YOUR_JETBRAINS_IDE > "Attempt to Install"
  3. Go to a terminal and run fig debug ime enable. A System Preferences window will appear and prompt you to install a third party Input Method.
  4. Run fig debug ime select
  5. Restart the IDE and autocomplete should appear🀞

PS. If your favorite Jebrains IDE doesn't appear in the list of integrations, please send me it's bundle identifier and I can add it.

Edit: it seems like there are intermittent issues when installing using JetBrains ToolBox. Sometimes it works and sometimes it doesn't.

duboiss commented 2 years ago
image

Works well on my side, I didn't even have to restart the IDE.

However after 2) I got a popup with an error, about "Input method" before I even did 3). The "learn more" link points to https://fig.io/docs/support/enabling-input-method, I just point it out to make sure you don't forget this part of the documentation :)

Thanks a lot

sebavuye commented 2 years ago

Can confirm it works with WebStorm 2021.3.1.

Screen Shot 2022-03-08 at 22 09 44

Thanks!

germagla commented 2 years ago

Can confirm it works on Pycharm CE 2021.3.2.

Screenshot 2022-03-08 at 9 20 13 PM
NovemberZulu commented 2 years ago

Doesn't seem to work for me, nothing related to Intellij IDEA in integrations

❯ osascript -e 'id of app "IntelliJ IDEA"'
com.jetbrains.intellij

(installed with JetBrains Toolbox)

Im-Fran commented 2 years ago

Yeah, seems to be an issue with toolbox setups cuz is not working for me :(

Edit: I've reinstalled my IDEs without toolbox and after following these steps I got it working on PhpStorm!! image

germagla commented 2 years ago

I installed PyCharm through JetBrains Toolbox, so I don't think it's a problem with that, since it's working for me.

BeauvR commented 2 years ago

I installed php storm from toolbox, but it's also working. Thanks!

etcook commented 2 years ago

Not working for me - IntelliJ IDEA Toolbox install

sametcelikbicak commented 2 years ago

Is anyone try with JetBrain's Rider IDE ?, I was testing but, after step 1, step 2 does not available like below

image

My Rider specs...

Screen Shot 2022-03-09 at 14 24 08
Billson7 commented 2 years ago

@mschrage

How did you get this in IDEA? Mines only showing WebStorm under integrations, not IDEA 😞

marggx commented 2 years ago

PHPStorm installed from toolbox works fine πŸš€