@@ -2,6 +2,7 @@ import { CommandLineIcon } from "@heroicons/react/24/outline";
22import { useContext } from "react" ;
33import { lightGray , vscForeground } from "../.." ;
44import { IdeMessengerContext } from "../../../context/IdeMessenger" ;
5+ import { isJetBrains } from "../../../util" ;
56
67interface RunInTerminalButtonProps {
78 command : string ;
@@ -10,16 +11,21 @@ interface RunInTerminalButtonProps {
1011export function RunInTerminalButton ( { command } : RunInTerminalButtonProps ) {
1112 const ideMessenger = useContext ( IdeMessengerContext ) ;
1213
14+ if ( isJetBrains ( ) ) {
15+ // JetBrains plugin doesn't currently have a way to run the command in the terminal for the user
16+ return null ;
17+ }
18+
1319 // Extract just the command line (the line after $ or the first line)
1420 function extractCommand ( cmd : string ) : string {
1521 // If the command contains a $ prompt, extract the line after it
16- if ( cmd . includes ( '$' ) ) {
22+ if ( cmd . includes ( "$" ) ) {
1723 const match = cmd . match ( / \$ \s * ( [ ^ \n ] + ) / ) ;
18- return match ? match [ 1 ] . trim ( ) : '' ;
24+ return match ? match [ 1 ] . trim ( ) : "" ;
1925 }
20-
26+
2127 // Otherwise, just take the first line
22- return cmd . split ( '\n' ) [ 0 ] . trim ( ) ;
28+ return cmd . split ( "\n" ) [ 0 ] . trim ( ) ;
2329 }
2430
2531 function runInTerminal ( ) {
0 commit comments