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
117 stars 47 forks source link

feat: clear log on execution start #1168

Closed scnwwu closed 1 week ago

scnwwu commented 1 month ago

Summary Hopefully will resolve #581 and #867

Added a new settings SAS.log.clearOnExecutionStart. When set to true, clear SAS Log output channel each time code execution starts. As the SAS Log is dedicated for one execution, display the executed file name on the channel for easier tracking.

User can click the Open Output in Editor menu item on the Output channel toolbar to open the log as a text file. The file content contains only the SAS Log for one execution. New execution will produce a new file and the previous file can be preserved.

Testing

  1. Verify that when SAS.log.clearOnExecutionStart set to false, the behavior is not changed from previous version.
  2. Verify that when SAS.log.clearOnExecutionStart set to true, previous log was cleared on next run.
smorrisj commented 1 month ago

Any thoughts on ideas that I mentioned on #867 ?

smorrisj commented 1 month ago

Some users are going to structure their programs to run selections / blocks of code in a given file. One potential drawback is that if a user were to set clearOnExecutionStart in that scenario, then the log would be cleared as each incremental execution happens, correct?

What if we allocated an output channel to each program that gets run on a session? If we did that, we'd need to be sure to clean it up on session close. This approach would allow those users to incrementally run sections of code, or an entire program, and have the log output show up accordingly in that program / code document's output channel. Maybe we could also set the active output channel based on the users active document tab. Not sure what this means for users that would have multiple programs in a layout however. We would need to investigate that scenario for sure.

scnwwu commented 1 month ago

I guess the tab layout like Studio would be preferred - log and result grouped by program. The output channels can't be split into separate tabs. And user can't manually remove a channel if we added too many channels. I'm thinking the log file (opened by Open Output in Editor) may work better. Even we disposed the channel, the log file remains. User can drag it into a new window with corresponding program. Switch or close whenever they want. The only thing is that the log file is plaintext and don't have error/warning colors.