a-h / templ

A language for writing HTML user interfaces in Go.
https://templ.guide/
MIT License
7.14k stars 236 forks source link

vscode: folded files in tree view seem to not work when rust-analyzer is installed #779

Closed s00500 closed 4 weeks ago

s00500 commented 1 month ago

So I am not sure why that is.. but it might be interesting to someone

I have rust-analyzer installed, when its active on a reload window the file folding in the filebrowser breaks. When deactivated and reloaded it is all fine...

Extension ID: rust-lang.rust-analyzer

I would be fine with this issue being closed, just wanted to not that there seems to be an incompatibility... fold-broken

a-h commented 4 weeks ago

It's because both extensions setup a default for explorer nesting (https://code.visualstudio.com/updates/v1_67#_explorer-file-nesting):

https://github.com/rust-lang/rust-analyzer/blob/48bbdd6a74f3176987d5c809894ac33957000d19/editors/code/package.json#L1751-L1755

https://github.com/templ-go/templ-vscode/commit/913c9b89ca152413024f28d0b7419ef147e44410

So, if both are loaded, one wins. rust-analyzer probably wins because lexically sorted, it's before templ-vscode.

Since both are just setting defaults, if you want both sets of nesting for a Rust and Go project that sits in the same workspace, you'd probably need to create a workspace specific config that combines the two.

joerdav commented 4 weeks ago

Per language configurationDefaults are possible, but it is not supported with the fileNesting settings.

As @a-h says you will need to add the nesting settings yourself to “File Nesting: Patterns”: Cargo.toml: Cargo.lock *.templ: ${capture}_templ.go