sassoftware / vscode-sas-extension

This SAS Extension for Visual Studio Code provides support for the SAS language, including features such as SAS syntax highlighting, code completion, hover help, code folding, outline, SAS code snippets and run SAS code.
https://sassoftware.github.io/vscode-sas-extension/
Apache License 2.0
121 stars 49 forks source link

{SAS Notebook] add support for tag to "skip" execution of cell in Run All #1199

Open cjdinger opened 2 months ago

cjdinger commented 2 months ago

Is your feature request related to a problem? Please describe. Jupyter Notebooks support "tag" attributes on the cell. In VS Code the extension seems to allow you to add a Cell Tag, but it does not appear in the file JSON for the .sasnb file. Goal is to support this and suggest a method or tag convention of 'NOEXEC' or 'IGNORE' so that Run All action would skip over any code cell tagged that way.

Describe the solution you'd like Support adding any tag with built-in Cell Tag menu (found in the ... or "more actions" menu on a cell). Then, implement the Run All action to skip code cells specifically tagged with NOEXEC (or whatever tag term you feel makes sense). Then we document the feature and practice for this. We can allow any arbitrary tag, but only certain tag values would have meaning for the actions we document.

Describe alternatives you've considered Came across this idea as I was looking at a way to extract a complete program from a .sasnb, and realizing that some cells might be only for interactive use and not intended for "batch" style runs. This "ignore" tag convention is what Jupyter Notebook does with nbconvert-style runs.

Environment SAS 9 | SAS Viya -- all notebooks

scnwwu commented 2 months ago

There's no built-in UI for tags. The Add Cell Tag menu item is from the extension https://marketplace.visualstudio.com/items?itemName=ms-toolsai.vscode-jupyter-cell-tags Unfortunately it provides the UI for all notebooks but can only work for jupyter-notebook. I created an issue https://github.com/microsoft/vscode-jupyter-cell-tags/issues/41

scnwwu commented 2 months ago

I tried Jupeter Notebook web application. I added a tag "ignore" on a cell and click "restart the kernel and run all", but all cell get run. I then tried VS Code with a .ipynb, added a tag "ignore" on a cell and click Run All. All cell run too. Where can I see the feature for Jupyter? Just want to understand the convention. Like do we really want to skip in Run All in VS Code UI or skip when export to .sas?

cjdinger commented 2 months ago

@scnwwu The convention I found is doc'd here. Maybe Run All does not respect this, but the "batch" process for a notebook does. That's the use case I was trying to support as I developed this technique for extracting all code to a single .SAS for running.