Skip to content

Hide "Run Python File" button on .pyi stub files#26026

Open
eleanorjboyd with Copilot wants to merge 2 commits into
mainfrom
copilot/make-run-python-button-configurable
Open

Hide "Run Python File" button on .pyi stub files#26026
eleanorjboyd with Copilot wants to merge 2 commits into
mainfrom
copilot/make-run-python-button-configurable

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown

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:
"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.

Copilot AI changed the title [WIP] Add option to configure visibility of 'Run Python File' button for .pyi files Hide "Run Python File" button on .pyi stub files Jul 2, 2026
Copilot AI requested a review from eleanorjboyd July 2, 2026 21:59
@eleanorjboyd eleanorjboyd marked this pull request as ready for review July 2, 2026 22:05
@eleanorjboyd eleanorjboyd added the bug Issue identified by VS Code Team member as probable bug label Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make it possible to configure visibility of the "Run Python File" button for .pyi files only

2 participants