xpipe-io / xpipe

Your entire server infrastructure at your fingertips
https://xpipe.io
Apache License 2.0
3.33k stars 83 forks source link

Feature Request: Add Editor - Intellij IDEA (and other Intellij Tools) #109

Closed muescha closed 9 months ago

muescha commented 10 months ago

Feature Request: Add Editor - Intellij IDEA (and other Intellij Tools)

crschnick commented 10 months ago

Are you using the JetBrains toolbox? It would be pretty easy to add support for all kinds of IntelliJ IDEs if they are installed with the toolbox application as that one automatically puts them into the PATH. However, for manual instillations, this would be a whole lot more work as I would have to query their installation locations in a platform dependent way.

crschnick commented 10 months ago

This has now been implemented in the latest PTB build at https://github.com/xpipe-io/xpipe-ptb, at least for toolbox installations. So you can try it out if you want

crschnick commented 10 months ago

This feature is now released, you can try it out in the latest version. Right now it requires the IDE to be in the PATH though

crschnick commented 10 months ago

Closing this as completed, feel free to reopen if something does not work as expected

muescha commented 10 months ago

Current Version: 1.7.11

More IntelliJ

there is also:

and are also the EAP versions. the EAP scripts are like ideaeap

Location

my scripts are all installed in ~/Library/Application Support/JetBrains/Toolbox/scripts from the toolbox app:

ll
Permissions Size User    Date Modified    Name
.rwxr-xr-x@  446 muescha 2023-12-19 12:30 appcode*
.rwxr-xr-x@  455 muescha 2023-12-19 12:30 appcode1*
lrwxr-xr-x@    - muescha 2023-12-20 18:45 fleet -> /Users/muescha/Applications/Fleet.app/Contents/app/bin/fleet*
lrwxr-xr-x@    - muescha 2023-12-20 18:45 fleet1 -> '/Users/muescha/Applications/Fleet 1.28.117 Public Preview.app/Contents/app/bin'/fleet*
.rwxr-xr-x@  446 muescha 2023-12-20 18:46 gateway*
.rwxr-xr-x@  458 muescha 2023-12-20 22:23 idea*
.rwxr-xr-x@  467 muescha 2023-12-20 22:23 ideaeap*
.rwxr-xr-x@  442 muescha 2023-12-20 18:45 rider*
.rwxr-xr-x@  452 muescha 2023-12-19 12:30 studio*
.rwxr-xr-x@  448 muescha 2023-12-19 12:30 webstorm*

Script Path

But the settings file is in an fixed path:

cat ~/Library/Application\ Support/JetBrains/Toolbox/.settings.json | jq .shell_scripts.location
"~/Library/Application Support/JetBrains/Toolbox/scripts"

Errors

with all IntelliJ products i get the following error - maybe it not load the ~/.zshrc? But when you read the path from the .settings.json file you can use this path.

io.xpipe.core.process.ProcessOutputException: Process returned exit code 127:
zsh: command not found: idea
at io.xpipe.core.process.ProcessOutputException.of(ProcessOutputException.java:36)
at io.xpipe.ext.proc.a.a(SourceFile:255)
at io.xpipe.ext.proc.a.discardOrThrow(SourceFile:349)
at io.xpipe.core.process.ShellControl.executeSimpleCommand(ShellControl.java:129)
at io.xpipe.app.prefs.ExternalEditorType$GenericPathType.launch(ExternalEditorType.java:155)
at io.xpipe.app.util.FileOpener.openInTextEditor(FileOpener.java:63)
at io.xpipe.app.util.FileOpener.lambda$openReadOnlyString$5(FileOpener.java:90)
at io.xpipe.app.util.FileBridge.openIO(FileBridge.java:206)
at io.xpipe.app.util.FileBridge.openReadOnlyString(FileBridge.java:140)
at io.xpipe.app.util.FileOpener.openReadOnlyString(FileOpener.java:90)
at io.xpipe.app.prefs.AppPrefs.lambda$createPreferences$27(AppPrefs.java:557)
at io.xpipe.app.util.ThreadHelper.lambda$runFailableAsync$1(ThreadHelper.java:40)
at io.xpipe.app.util.ThreadHelper.lambda$wrap$0(ThreadHelper.java:19)
at java.lang.VirtualThread.run(VirtualThread.java:309)
crschnick commented 10 months ago

The text editor setting within xpipe is meant to be a general purpose text editor, i.e. one that you would use to edit arbitrary files. I don't see anyone using more exotic Jetbrains IDEs for that purpose when there exist more general editors like vscode or fleet. There is still the option to open a file with the default program for that file extension, so if you want to edit certain source files of a language, it should still be able to open the correct editor assuming that it is the default in the OS for that file type. I can see people using things like IntelliJ here because that one basically supports any file type as well but the more exotic versions are more specialized.

I think adding more and more versions here does not add a lot of value, at the end of the day you can still open them using the Custom Command setting if you really want to do it.

Were exactly the scripts by the toolbox are located shouldn't really matter as long as they are in the PATH. I tested it myself on my mac and it was able to launch them, so I'm not sure why it does not work on your end. XPipe launches a zsh login shell, so all profile files should be executed and the PATH should be correct. How does your zshrc look like where it tries to set the PATH?

muescha commented 10 months ago

if I open it in terminal or in warp it loads the PATH is set.

# add intellij toolbox command lines
export PATH=$PATH:$HOME/Library/Application\ Support/JetBrains/Toolbox/scripts

and this:

which idea
/Users/muescha/Library/Application Support/JetBrains/Toolbox/scripts/idea
crschnick commented 10 months ago

Hm ... I think I can implement some solution so users can properly diagnose these PATH issues because right now that is difficult. Give me a few days

crschnick commented 10 months ago

Okay so what you can try now is downloading the latest PTB build at https://github.com/xpipe-io/xpipe-ptb, launch it in debug mode, then go to Settings -> Troubleshoot -> Shell command test and enter any command, e.g. to print your PATH. The output will then be shown in the debug terminal window

muescha commented 10 months ago

Downloaded: MacOS .dmg Portable (ARM 64)

there is no option for shell command test when I started in Debug Mode.

but: I can start the Editors in the PTB and checked: I can not start in "normal" 1.6.11

muescha commented 10 months ago

same with this: MacOS .pkg Installer (ARM 64) I can start the Editors in the PTB

crschnick commented 10 months ago

Hmm so this is not here? image

I actually have to see what might have fixed the issue. There were many changes across the board but none was properly targeted for this issue for now.

muescha commented 10 months ago

oh - I looked in the Troubleshoot tab :D

moment - found

when I echo $PATH then I can see the IntelliJ Toolbox scripts path in PATH

muescha commented 10 months ago

I uninstalled the xpipe-ptb with command line:

sudo "/Applications/XPipe PTB.app/Contents/Resources/scripts/uninstall.sh"

and installed the xpipe again with homebrew:

brew reinstall --force xpipe-io/tap/xpipe
muescha commented 10 months ago

Results:

X-Pipe 1.7.11

in normal mode: it not start: Error in debug mode: it started without the error

again check with: MacOS .dmg Portable (ARM 64)

in normal mode: it not start: Error in debug mode: it started without the error

Note

It depends on the start mode - debug or normal mode

muescha commented 10 months ago

~also difference:~

~PTB started the debug mode script in iTerm2~ ~normal started in my already open Warp ( /Users/muescha/.xpipe/temp/exec-1843110838.sh )~

update: the terminal app was selected in section "Terminal" - in PTB it was at the default iTerm2

crschnick commented 10 months ago

That is interesting. So somehow the environment is not properly set when launching the local shell itself. The debug mode works because it inherits the environment variables of your shell session that you used to start the debug script.

I don't really see why this does not work for you because all we do is start zsh -l in the background. The only difference here is that there is no tty available, by that should not influence the profile file execution and path setup.

I tested the same thing as you on my machine and was not able to reproduce it. I can augment the developer shell command test to also produce output for non-debug sessions, give me a few hours for that.

muescha commented 10 months ago

you can also include to print the path while startup in the xpipe.log - then no GUI is needed

crschnick commented 10 months ago

That is also a good idea

muescha commented 10 months ago

note: macOS ist still on 13.5.2 (22G91)

crschnick commented 10 months ago

Alright, so I improved the the developer shell command test in the latest PTB to also print to the logs in normal mode.

You can try the latest version, run it in normal mode, go to settings -> Troubleshoot -> Open logs. Then run the developer shell command test again and any output should show up in the log file.

For now I do not print the path outright, simply because it was quite tedious looking for it in the log output in the first place for me. With the current solution you can always look at the tail of the log.

muescha commented 10 months ago

thx

Open logs also not work as expected:

16:10:22:537 - debug: Command finished {
    command=fleet '/Users/muescha/.xpipe-ptb/logs/2023-12-28_16-07-02/xpipe.log'
    finishReason=NORMAL_FINISH
    exitCode=127
}
16:10:22:540 - error: Unable to launch editor Fleet.
Maybe try to use a different editor in the settings.
io.xpipe.core.process.ProcessOutputException: Process returned exit code 127:
zsh: command not found: fleet
    at io.xpipe.core.process.ProcessOutputException.of(ProcessOutputException.java:36)
    at io.xpipe.ext.proc.a.a(SourceFile:256)
    at io.xpipe.ext.proc.a.discardOrThrow(SourceFile:359)
    at io.xpipe.core.process.ShellControl.executeSimpleCommand(ShellControl.java:136)
    at io.xpipe.app.prefs.ExternalEditorType$GenericPathType.launch(ExternalEditorType.java:155)
    at io.xpipe.app.util.FileOpener.openInTextEditor(FileOpener.java:62)
    at io.xpipe.app.prefs.TroubleshootComp.lambda$createActions$3(TroubleshootComp.java:89)
    at io.xpipe.app.comp.base.TileButtonComp.lambda$createBase$0(TileButtonComp.java:36)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Node.fireEvent(Node.java:8875)
    at javafx.scene.control.Button.fire(Button.java:203)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:207)
    at com.sun.javafx.scene.control.inputmap.InputMap.handle(InputMap.java:274)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:247)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3984)
    at javafx.scene.Scene.processMouseEvent(Scene.java:1890)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2708)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:411)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:301)
    at java.security.AccessController.doPrivileged(AccessController.java:400)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:450)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:424)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:449)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:551)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.mac.MacView.notifyMouse(MacView.java:127)

16:10:22:551 - debug: Added stylesheets for scene
16:10:22:551 - debug: Set stylesheet reload listener
crschnick commented 10 months ago

I guess you would need to quickly change the editor to one that is working, open the log, then change it again to run the commands.

crschnick commented 10 months ago

So I played around a bit with better PATH initialization (hopefully). You can try whether the latest version of https://github.com/xpipe-io/xpipe-ptb works for you

crschnick commented 9 months ago

The fix for this is now included in the latest release.

I'm very confident that this is now fixed so I'm preemptively closing this issue.

If it still does not work, well ....

muescha commented 9 months ago

I am back on computer - Now it is working without error :) thx