Skip to content

Commit 30e230b

Browse files
Hide "Run Python File" button on .pyi stub files (microsoft#26026)
The editor-title "Run Python File" buttons appear on `.pyi` stub files, which cannot meaningfully be executed, because `.pyi` and `.py` share `resourceLangId == python`. ### Change - In `package.json`, tighten the `when` clauses of both `editor/title/run` contributions (`python.execInTerminal-icon`, `python.execInDedicatedTerminal`) to exclude `.pyi`: ```jsonc "when": "resourceLangId == python && resourceExtname != .pyi && !isInDiffEditor && !virtualWorkspace && shellExecutionSupported" ``` ### Notes - Applied as a sensible default rather than a new setting: stub files are type-hint-only and not runnable, so no user-facing configuration is warranted. - Scoped strictly to the two editor-title run buttons; other Python command contributions (command palette, explorer context, REPL, etc.) are unchanged. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Eleanor Boyd <26030610+eleanorjboyd@users.noreply.github.com>
1 parent 9189164 commit 30e230b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,13 +1441,13 @@
14411441
"command": "python.execInTerminal-icon",
14421442
"group": "navigation@0",
14431443
"title": "%python.command.python.execInTerminalIcon.title%",
1444-
"when": "resourceLangId == python && !isInDiffEditor && !virtualWorkspace && shellExecutionSupported"
1444+
"when": "resourceLangId == python && resourceExtname != .pyi && !isInDiffEditor && !virtualWorkspace && shellExecutionSupported"
14451445
},
14461446
{
14471447
"command": "python.execInDedicatedTerminal",
14481448
"group": "navigation@0",
14491449
"title": "%python.command.python.execInDedicatedTerminal.title%",
1450-
"when": "resourceLangId == python && !isInDiffEditor && !virtualWorkspace && shellExecutionSupported"
1450+
"when": "resourceLangId == python && resourceExtname != .pyi && !isInDiffEditor && !virtualWorkspace && shellExecutionSupported"
14511451
}
14521452
],
14531453
"explorer/context": [

0 commit comments

Comments
 (0)