WolframResearch/vscode-wolfram

Section folding

hifismith opened this issue · 4 comments

Can sections and subsections be recognized and folded? In the screenshot I've used cmnd+K+0 to fold everything, but the sections and subsections are expanded.
image

Sure, I will add this in the next few days.

I've added foldingRange support in the latest push of this repo:
https://github.com/WolframResearch/LSPServer.

You can test this by building the paclet from source, Otherwise, I will be making an update in the next few weeks, and your paclet will update automatically.

Nice! Thanks. I'll have to try it when the update comes out.

@bostick , it appears something has changed in the LSPServer. Section folding has a bug now. It's Christmas Eve so please don't work on this until you're back in the office.

This code shows the "Import" section declaration and then a function, which I've folded, followed by the initialization of variable 'sheets'
image

This "Import" section goes until line 470, but when I fold it, you'll see it only folds that first function.
image

A couple things stand out.

  1. Folding functions is a new feature I believe. It seems to be interfering with the section folding.
  2. The function folding is a nice feature that would be awesome to add to other large expression constructs like With, Block, Module, etc. For example, the next bit of code is a function encapsulated within a "With" expression. I am unable to fold it because of the encapsulation. It'd be nice to be able to fold the With statement:

image