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
244 stars 16 forks source link

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

Open perfect-quinquennium opened 6 months ago

perfect-quinquennium commented 6 months 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 6 months 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 6 months 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 6 months 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).

AtmosphericIgnition commented 1 month ago

Hi, I spent quite some time trying to figure out why my script is not running, only to discover from this Github page that input functions are not supported. Would you mind adding something that prints an error into the Matlab terminal that the function is not supported? This would have saved me some time troubleshooting today.