Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to code collapse #31

Open
abdonrd opened this issue Feb 26, 2019 · 12 comments
Open

Add support to code collapse #31

abdonrd opened this issue Feb 26, 2019 · 12 comments
Labels
enhancement New feature or request

Comments

@abdonrd
Copy link
Contributor

abdonrd commented Feb 26, 2019

Add support to code collapse:

feb-26-2019 17-34-51

@runem
Copy link
Owner

runem commented Aug 8, 2019

Update on this: I build support for this feature but ended up disabling it last minute because it was sometimes interfering with the Typescript Language Server. Specifically, I would get old versions of source files after I called "program.getSourceFile(fileName)" from the "getOutliningSpans" callback, so it seemed like a bug in Typescript. However I didn't get time to investigate it further. Soon I plan on trying to enable it again to see if it has somehow been fixed with a newer version of Typescript.

@runem runem transferred this issue from runem/vscode-lit-plugin Aug 8, 2019
@abdonrd
Copy link
Contributor Author

abdonrd commented Aug 30, 2019

Any news? Thanks in advance, @runem!

@aguillenb
Copy link

Any news? Thanks @runem!

@runem
Copy link
Owner

runem commented Sep 22, 2019

I tried to enable code collapse again, but now it seems like the getOutliningSpans callback is never being called by vscode. I also tried with the lit-html vscode extension, and it seems like folding is not working there as well.

I made sure to double check all my settings, but I have enabled code folding everywhere, and code-folding also works for other JS/TS code. All extensions, except lit-plugin, were disabled.

In that process I also discovered that setting "editor.foldingStrategy": "indentation" will actually enable code folding for lit-html templates given that the HTML is correct indented.

Of course, it could also be a breaking change for TS language service that I'm not aware of, but I couldn't find any related issues/changelogs.

As mentioned, it could be my local vscode configuration, so it would be really helpful to me if you are able to test the feature locally yourselves. You can find the the .vsix extension file with code collapse enabled here: https://github.com/runem/lit-analyzer/suites/233972939/artifacts/46998 :-)

@runem runem added the enhancement New feature or request label Sep 22, 2019
@aguillenb
Copy link

I tried to enable code collapse again, but now it seems like the getOutliningSpans callback is never being called by vscode. I also tried with the lit-html vscode extension, and it seems like folding is not working there as well.

I made sure to double check all my settings, but I have enabled code folding everywhere, and code-folding also works for other JS/TS code. All extensions, except lit-plugin, were disabled.

In that process I also discovered that setting "editor.foldingStrategy": "indentation" will actually enable code folding for lit-html templates given that the HTML is correct indented.

Of course, it could also be a breaking change for TS language service that I'm not aware of, but I couldn't find any related issues/changelogs.

As mentioned, it could be my local vscode configuration, so it would be really helpful to me if you are able to test the feature locally yourselves. You can find the the .vsix extension file with code collapse enabled here: https://github.com/runem/lit-analyzer/suites/233972939/artifacts/46998 :-)

Hy @runem , seems like "editor.foldingStrategy": "indentation" solves the problem. Thanks a lot!

@blikblum
Copy link

Hi looking to testing but tying https://github.com/runem/lit-analyzer/suites/233972939/artifacts/46998 i get "Failed to generate URL to download artifact."

@tvvignesh
Copy link

@runem Awesome! "editor.foldingStrategy": "indentation" works for me as well 🎉

@blikblum
Copy link

Just for information, in my opinion "editor.foldingStrategy": "indentation" is not ideal solution since can affect other code like plain html or js that is not properly indented

@jjspace
Copy link

jjspace commented Jun 15, 2021

FWIW the lit-html plugin definitely supports folding html at this point. It's one of the few features that's preventing me from completely switching over to only using lit-plugin for our LitElement project

@blikblum
Copy link

FWIW the lit-html plugin definitely supports folding html at this point. It's one of the few features that's preventing me from completely switching over to only using lit-plugin for our LitElement project

Unfortunately is not true anymore with recent vscode.

I upgraded to to 1.79 and code folding stopped work even with lit-html installed. I downgraded to 1.76 and code folding works with lit-html and lit-plugin extensions installed alongside

(1.78 also did not work, i did not tested 1.77)

As a side note, intelisense completion performance is a lot worse with recent vscode. Not sure if related

@jjspace
Copy link

jjspace commented Jun 12, 2023

@blikblum The recent issues with lit-plugin are related to vscode 1.77 bumping to TS 5.0 which lit-analyzer is not compatible with. See #302 and #299

@ouweiya
Copy link

ouweiya commented Aug 12, 2023

Code folding is not yet supported, but I've found a workaround. By accessing the command palette and typing Fold, you'll see multiple folding level options. One of these is create Folding Range From Selection, which has the shortcut Ctrl + k Ctrl + , on my machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants