lit-analyzer
lit-analyzer copied to clipboard
Add support to code collapse
Add support to code collapse:
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.
Any news? Thanks in advance, @runem!
Any news? Thanks @runem!
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 :-)
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 thelit-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!
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."
@runem Awesome! "editor.foldingStrategy": "indentation"
works for me as well 🎉
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
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
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 usinglit-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
@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 https://github.com/runem/lit-analyzer/issues/302 and #299
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.