vors / jupyter-powershell

PowerShell language kernel for Jupyter
MIT License
132 stars 26 forks source link

Refactor send_input to handle single line comments and lingering output #29

Closed corivera closed 4 years ago

corivera commented 4 years ago

Fixes https://github.com/microsoft/azuredatastudio/issues/8277 Fixes https://github.com/microsoft/azuredatastudio/issues/7999

There are a couple of things going on in this change. Originally, I intended to fix the above issues with end of line comments by adding a newline to the end of the input text. That solved the comment problem, but then I started seeing issues with cell execution always returning the last result run. Looks like we continually append text to self.output (even after a command "completes"), which messes up the string parsing to get cell outputs later. My solution here was to clear self.output before running a command.

Since we're modifying self.output in a multithreaded environment, I also decided to combine the input and output functions and add some locking for good measure.

Any ideas for potential edge case tests here would be appreciated.