hide terminal button in jetbrains
This commit is contained in:
parent
10a264e2c6
commit
529ea273a3
1 changed files with 10 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ import { CommandLineIcon } from "@heroicons/react/24/outline";
|
|||
import { useContext } from "react";
|
||||
import { lightGray, vscForeground } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { isJetBrains } from "../../../util";
|
||||
|
||||
interface RunInTerminalButtonProps {
|
||||
command: string;
|
||||
|
|
@ -10,16 +11,21 @@ interface RunInTerminalButtonProps {
|
|||
export function RunInTerminalButton({ command }: RunInTerminalButtonProps) {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
if (isJetBrains()) {
|
||||
// JetBrains plugin doesn't currently have a way to run the command in the terminal for the user
|
||||
return null;
|
||||
}
|
||||
|
||||
// Extract just the command line (the line after $ or the first line)
|
||||
function extractCommand(cmd: string): string {
|
||||
// If the command contains a $ prompt, extract the line after it
|
||||
if (cmd.includes('$')) {
|
||||
if (cmd.includes("$")) {
|
||||
const match = cmd.match(/\$\s*([^\n]+)/);
|
||||
return match ? match[1].trim() : '';
|
||||
return match ? match[1].trim() : "";
|
||||
}
|
||||
|
||||
|
||||
// Otherwise, just take the first line
|
||||
return cmd.split('\n')[0].trim();
|
||||
return cmd.split("\n")[0].trim();
|
||||
}
|
||||
|
||||
function runInTerminal() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue