Skip to content

Commit 529ea27

Browse files
committed
hide terminal button in jetbrains
1 parent 10a264e commit 529ea27

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/RunInTerminalButton.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CommandLineIcon } from "@heroicons/react/24/outline";
22
import { useContext } from "react";
33
import { lightGray, vscForeground } from "../..";
44
import { IdeMessengerContext } from "../../../context/IdeMessenger";
5+
import { isJetBrains } from "../../../util";
56

67
interface RunInTerminalButtonProps {
78
command: string;
@@ -10,16 +11,21 @@ interface RunInTerminalButtonProps {
1011
export 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

Comments
 (0)