shinyypig / matlab-in-vscode

A vscode extension for matlab.
MIT License
45 stars 5 forks source link

Bug related to multi-line input keyword (e.g, `for`) in strings & comments (python backend) #16

Closed rq-Chen closed 1 year ago

rq-Chen commented 1 year ago

The python backend supports multi-line input by detecting some control flow keywords (e.g., 'for') in the input (see here). However, that leads to a bug when the input contains a string/character array which contains these keywords. Example:

>>> tmp = "This string contains a keyword **for** and will stop the execution.";

After pressing enter, the terminal will continue to wait for input until it sees an end.

For the pre-released version, this issue also occurs when the keywords appear in the comments:

>>> % This comment contains a keyword **for** and will stop the execution.
shinyypig commented 1 year ago

Thank you for pointing out this error! It should have been fixed in pre-release version 0.4.7. Please check and let me know if it's effective.

rq-Chen commented 1 year ago

It seems like this update removed the multi-line functionality altogether despite fixing the aforementioned issue. Now if I do:

>>> for

and return, I got:

>>>
Error: At least one END is missing. The statement beginning here does not have a matching end.

The problem also occurs when I run code chunk with Ctrl+Enter or paste a chunk of code into the terminal.

shinyypig commented 1 year ago

It seems that this bug is not very easy to fix. I might need to implement a simple MATLAB code interpreter, which could take quite some time. Do you have any suggestions?

shinyypig commented 1 year ago

Should be fixed in pre-release 0.4.8.