mathworks / MATLAB-extension-for-vscode

This extension provides support for editing MATLAB® code in Visual Studio® Code and includes features such as syntax highlighting, code analysis, navigation support, and more.
https://marketplace.visualstudio.com/items?itemName=MathWorks.language-matlab
MIT License
215 stars 13 forks source link

Input command not working in MATLAB extension for Visual Studio Code #144

Open perfect-quinquennium opened 1 month ago

perfect-quinquennium commented 1 month ago

Describe the bug The input command in the MATLAB extension for Visual Studio Code is not working, and as a result, all functions and scripts that require user input do not function as expected.

To Reproduce

  1. Open a MATLAB script in Visual Studio Code.
  2. Add the following code to the script:
  3. Enter the following withdrawal = input("Enter the amount you'd like to withdraw\n> "); fprintf("You want to withdraw %d", withdrawal)
  4. Run the script using the MATLAB extension.

Expected behavior The script should display the prompt message "Enter the amount you'd like to withdraw" and wait for the user to input a value. It should then print the entered value.

Screenshots When running the script, the cursor blinks but nothing happens when the user enters a value and presses Enter. When the user presses Ctrl+C to terminate the program, the following error is displayed:

Screenshot (90)

Useful Information

Additional context Cursor blinks also when you enter input command directly into the command prompt: Screenshot (91)

philipb314 commented 1 month ago

Thank you for reporting this issue. This is something I can reproduce. As of right now interactive command window workflows such as input, more, pause, etc. are not supported by the extension. However, this is definitely something that we will be working on resolving in a coming release.

perfect-quinquennium commented 1 month ago

Thank you for acknowledging the issue and confirming that it can be reproduced. I'm glad to hear that you're actively working on resolving the lack of support for interactive command window workflows in the extension. I look forward to the forthcoming release that addresses this limitation. If there are any workarounds or updates in the meantime, please keep me informed. Thank you for your attention to this matter.

jlw154 commented 1 month ago

On macOS Ctrl+C doesn't seem to be captured when it's waiting for pause/input. The only way I've found to interrupt it is to look up the process and issue an interrupt ("ps -ef | grep -i matlab" to find the pid, and "kill -2 pid" to send the interrupt signal).