sst / ion

SST v3
https://sst.dev
MIT License
1.58k stars 201 forks source link

Better support for Jetbrains IDE #849

Open dmeehan1968 opened 1 month ago

dmeehan1968 commented 1 month ago

I use Jetbrains PHPStorm as my IDE, and the new multiplexor mode for sst doesn't play nicely with the IDE:

  1. Mouse scroll causes a lot of flicker as SST cycles through the SST, Function, and items in the left navigation. It's effectively mapped to the up/down arrow keys but any scroll movement seems to cause multiple equivilent keypresses.
  2. Ctrl-U/D isn't intuitive as the method for scrolling through the output in the right
  3. Ctrl-D conflicts with a 'run debug' shortcut so its not possible to scroll down. [Enter] will return to the end of the output.
  4. Scrolling is actually 'paging' through the content, which means when output crosses the page boundary its hard to grok the context, especially with the inability to scroll down
  5. It's not possible to Ctrl-C selected output from the window, the IDE doen't seem to recognise that text is selected, and the context menu (right click on selected text) doesn't show the copy action as active.
  6. There is seemingly no (documented) support for local debugging for sst projects. The best I can do at the moment is console logging, which is frustrated by the above difficulties, or by unit testing (jest debugging works fine).

These problems (aside from debugging) didn't exist in the prior 'basic' mode, and I'm questioning why this menu based UI is necessary to support the multiplexor mode. If we take something like jest in watch mode, this support switching to different test coverage through keypresses, and doesn't break the natural scroll of the IDE output window. Perhaps a similar approach could be taken by sst?

thdxr commented 3 weeks ago

we'll need to try and see what intellij is doing that breaks with this - it likely has a poorly implemented terminal emulator

our situation isn't exactly the same as jest - we don't control the output of the child resource so it does need to go down to a more raw level

i suggest just doing sst dev --mode=basic since this experience is quite bad for you in intellij

dmeehan1968 commented 3 weeks ago

@thdxr Thanks, agree with that approach. Jetbrains IDE actually have two terminal emulators, but I'm still using the older one because the newer ones adds features that I found problematic (at least when I tried in earlier versions). I think its been the 2024 releases that have had that.

Saying that, I think when you invoke a build/run command, it always uses the older plain terminal.

This issue is that for SST you have chosen specific keyboard inputs that may conflict with any IDE, and as most IDE's allow keyboard shortcut mapping there is always a risk that you'll conflict with user preferences.

With the mouse/scroll input, its possible that either my macbook settings or Jetbrains settings controlling the velocity of scroll are causing more 'up'/'down' key presses than are useful (I know I have my key repeat settings on max as I'm old school and rarely use a mouse for editor navigation - just force of habit/preference).

More broadly, I'm actually failing to see why you 'need' to use a 'UI' before just console inputs for the multiplexor. I appreciate that because you have multiple processes, each with its own console output, you need to switch between them somehow, but as you are maintaining some sort of buffer of output from each process, you could just use some sort of 'press X for sst, Y for nextjs'... prompt and then repeat some part of the output. The visual UI, whilst 'pretty' may just not work well when integrating into an IDE. Of course, you might decide that its worth the effort of actually implementing SST as an IDE 'plugin' but that might actually be a lot of effort, but maybe one the community can help with. That way you get a more 'first class' integration.