Skip to content

feat: Allow running Python code files in SAS Content #1815

Merged
2TomLi merged 4 commits intomainfrom
258-allow-running-python-code-files-in-sas-content
Mar 6, 2026
Merged

feat: Allow running Python code files in SAS Content #1815
2TomLi merged 4 commits intomainfrom
258-allow-running-python-code-files-in-sas-content

Conversation

@2TomLi
Copy link
Contributor

@2TomLi 2TomLi commented Mar 3, 2026

Summary:
Fix issue #258: Allow running Python code files in SAS Content. Currently, the "Run in SAS" button and related commands are hardcoded to only appear when editorLangId == sas. We need to broaden these when clauses in
package.json to also include .py files (editorLangId == python), provided they are opened from the SAS Content or SAS Server navigator (which use the URI schemes sasContent, sasContentReadOnly, sasServer, sasServerReadOnly).

Testing:
Automated Tests
Run the extension's unit tests using npm run test to make sure we didn't break basic startup or command execution.

Manual Verification
I compiled the UI and theoretically test opening a .py file from sasContent and verify that the context values effectively enable the play button.

TODOs:

@2TomLi 2TomLi requested a review from scottdover March 3, 2026 20:28
@2TomLi 2TomLi changed the title feat: Allow running Python code files in SAS Content #258 feat: Allow running Python code files in SAS Content Mar 3, 2026
2TomLi added 2 commits March 3, 2026 15:48
Signed-off-by: Tom Li <tom.li@sas.com>
Signed-off-by: Tom Li <tom.li@sas.com>
@2TomLi 2TomLi force-pushed the 258-allow-running-python-code-files-in-sas-content branch from d3d90f1 to 43d9393 Compare March 3, 2026 20:49
package.json Outdated
"keybindings": [
{
"when": "editorFocus && editorLangId == sas && !SAS.hideRunMenuItem",
"when": "(editorLangId == sas || (editorLangId == python && resourceScheme =~ /^sas(Content|Server)(ReadOnly)?$/)) && !SAS.hideRunMenuItem",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we probably want editorFocus here still

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this regex might be a little more concise and match what we need: /^sas(Content|Server).*/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have modified @scottdover, please review.

 updated all occurrences in

to be more permissive and concise, use regular expression (resourceScheme =~ /^sas(Content|Server).*/).

Signed-off-by: Tom Li <tom.li@sas.com>
@2TomLi 2TomLi force-pushed the 258-allow-running-python-code-files-in-sas-content branch from f176e2f to 43dcee5 Compare March 4, 2026 02:41
Copy link
Contributor

@scottdover scottdover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks alright to me :)

@2TomLi 2TomLi merged commit b0acd8e into main Mar 6, 2026
2 checks passed
@2TomLi 2TomLi deleted the 258-allow-running-python-code-files-in-sas-content branch March 6, 2026 16:40
@2TomLi 2TomLi added this to the 1.19.0 milestone Mar 9, 2026
@2TomLi 2TomLi self-assigned this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants