Файли
openidea/src/features/python-console/PythonConsole.module.css
T
LU XIANGRUIтаwildcatDownstairs c632dfa01c feat(python): add a Python Console tool window (#5164)
Adds a Python Console tool window: an interactive interpreter of the project's Python (the one Settings and the status bar show; in a workspace, the member the active file is in), started in the project root with the source roots on `PYTHONPATH`. It uses IPython when the interpreter has it and plain Python otherwise, in its own `__main__`. Enter runs the input, Shift+Enter adds a line, Up/Down recall earlier inputs, and while code runs a typed line answers its `input()`. A Variables pane lists the console's globals after each run. Execute Selection in Python Console (`python.console.executeSelection`, Alt+Shift+E, also in the editor context menu of Python files) sends the selection or the current line, starting the console if needed; a selection inside an indented block is dedented. The console is a small driver script run on the existing Run process host, so there are no backend changes.

Closes #5148

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-22 14:34:50 +08:00

86 рядки
1.5 KiB
CSS

.view {
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
background: var(--bg-editor);
}
.toolbar {
flex: none;
display: flex;
align-items: center;
gap: var(--space-1-5);
padding: var(--space-1) var(--space-2);
border-bottom: 1px solid var(--border);
background: var(--bg-elev);
}
.header {
margin-left: var(--space-2);
color: var(--fg-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.main {
display: flex;
flex-direction: column;
min-height: 0;
}
.output {
flex: 1;
min-height: 0;
overflow: auto;
padding: var(--space-1) var(--space-2);
white-space: pre-wrap;
overflow-wrap: anywhere;
color: var(--fg-editor);
user-select: text;
-webkit-user-select: text;
cursor: text;
}
.input {
flex: none;
resize: none;
border: 0;
border-top: 1px solid var(--border);
padding: var(--space-1) var(--space-2);
background: var(--bg-editor);
color: var(--fg-editor);
/* Like the Debug Console's prompt: the caret shows focus; a ring would be cut by the window's rounded corner. */
outline: none;
}
.variables {
overflow: auto;
border-left: 1px solid var(--border);
}
.varList {
font-family: var(--font-mono);
font-size: var(--fs-code);
}
.varRow {
display: flex;
gap: var(--space-2);
padding: var(--space-0-5) var(--space-2);
white-space: nowrap;
}
.varName {
color: var(--fg-editor);
}
.varType {
color: var(--fg-muted);
}
.varValue {
overflow: hidden;
text-overflow: ellipsis;
color: var(--fg-editor);
}