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
230 stars 15 forks source link

New sticky scroll/folding fix might behave unexpectedly #32

Open anakinsleftleg opened 1 year ago

anakinsleftleg commented 1 year ago

I can't say this is actually a straight bug, however it's not quite what I expected.

The fix to the sticky scroll heading seems to work now but using the default settings in VSCode for sticky scroll has the sticky parts based on the document outline. And in the outline, all that shows up are function names. So you only see sticky function names. However if you set the VSCode setting to foldingProviderModel, then it sticks based on anything that will fold in the code (if statements and others). I guess i expect the default behavior to be with the folding elements but no one would know that behavior is possible without knowing to change the sticky scroll behavior setting, since the outline is not populated by anything but functions.

Not sure what I'm suggesting here. I guess I'd like the outline to contain all the folding elements.

image

dklilley commented 1 year ago

Thanks for raising this suggestion!

To confirm my understanding - you are saying that you would prefer if the code outline included all if, for, switch, etc. statements to make the different Sticky Scroll models work the same?

anakinsleftleg commented 1 year ago

I guess? I mean, to some degree i think this is VSCode's fault, but that's not going to change. It's more like, you'd have to change in order to work around the bad default from VSCode.

Or perhaps one solution is you include in your getting started guide that if you want this certain behavior, then switch the sticky mode to that other mode instead of the default outline mode. That way you are letting the user know what they can do to get the behavior they want. As it is now, VSCode doesn't make it obvious.