nwolverson / purescript-language-server

MIT License
184 stars 41 forks source link

Add folding ranges #63

Closed i-am-the-slime closed 4 years ago

i-am-the-slime commented 4 years ago

What?

This adds a folding range for imports (that means it's possible to "hide/show" all imports with the little caret left of the line or a command).

Why?

This extension is already really good at managing imports and I'm more than happy to delegate this 💩 to a computer. However, the structure of PureScript programs requires imports to be one of the first things one sees when opening a file. Being able to automatically hide them mitigates this problem.

How?

It is quite naïvely implemented (it goes from the first line that starts with import until the last that does).

Misc

I also updated some dependencies. Note that this change is on top of my PR that ports to spago.

i-am-the-slime commented 4 years ago

folding Here's an example of how it looks.

nwolverson commented 4 years ago

This will be not-folded by default right?

i-am-the-slime commented 4 years ago

No. There is a plugin needed for this in VSCode. I think there's even an issue for it.

Edit: To be clear: You are right, it will be not-folded by default (at least in VSCode). I think this is up to the editor, there is no code that sends a "fold this" command through the language server or something like that.

i-am-the-slime commented 4 years ago

Essentially what it does is provide which ranges the user could fold/unfold (where to add a rotating triangle) and how much will be shown/revealed when it's clicked).