Block Comments should force a new line, else they're treated as line comments
See original GitHub issueHi,
I really enjoy your Matlab Extension. I find VSCode’s editing capabilities far outpace Matlab’s editor.
I noticed this anomaly while checking out various VSCode keyboard shortcuts.
How to reproduce:
% here follows code, the first line of which I'd like to block comment
disp(a)
disp(b)
disp(c)
select the first two disp(…) commands Toggle block comment (on mac, shift-alt-A)
Result:
%{ disp(a)
disp(b) %}
disp(c)
Expected:
%{
disp(a)
disp(b)
%}
disp(c)
Reasoning MATLAB only understands block comments when they’re alone on a line (with the exception of whitespace) In this particular case, the first line is treated as though it had the typical line comment. The second line is interpreted by MATLAB as though it ends with a commented-out closing brace.
What I tried:
By modifying the matlab.configuration.json
file, I could add the line feeds, but then the line comment no longer toggled back off. Still, this behavior might be preferable to the existing behavior.
"blockComment": [ "\n%{\n", "\n%}\n" ]
side note: even MATLAB (r2017a) doesn’t seem to have a shortcut key combo for this feature
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
I’ve updated the extension with your proposal @CelsoReyes, I find it better than the previous behavior.
I’m keeping the issue open for now, since it’s not completely fixed. I’m putting it on hold though, because as @sco1 has explained, it’s an issue related to how VSCode is managing those block comments.
I’ve opened an issue on VSCode’s repository: https://github.com/Microsoft/vscode/issues/48074
I’m putting this issue on hold until we know if that will be fixed.
It seems to work fine.
But it adds 2 blank lines and doesn’t indent the comments (except for the first one). I tested on vs-code for Windows.
Result:
Expected: