Matsuuu / custom-elements-language-server

Custom Elements Language Server provides useful language features for Web Components. Features include code actions, completions, diagnostics and more.
BSD 3-Clause "New" or "Revised" License
84 stars 0 forks source link

Support for Solid.js html template tag. #27

Closed trusktr closed 11 months ago

trusktr commented 1 year ago

It would be neat to support Solid's html template tag.

There are also more than one way to author Custom Elements with Solid:

The html template tag has slightly different syntax than Lit's. I'll be back to post a breadth of examples.

trusktr commented 1 year ago

Alight, here's a Solid playground with examples:

https://playground.solidjs.com/anonymous/d438cbc6-2c01-4a28-b8b2-106bbd1b4321

There are some other things I didn't include yet, like class and style handling.

Matsuuu commented 1 year ago

Thanks! I'll look into what we can currently support

Matsuuu commented 1 year ago

I think supporting language server features inside of the html template literals could be easy. The quirks of a bit of a different syntax from the "Native" one is something I'm a bit scared of but I'll have to see how it handles when I get there.

As for supporting the custom elements built with Solid, I think it would be beneficial for both parties is the team supporting solid-element provided a way of generating a Custom Elements Manifest for those components.

One approach towards that would be to create a plugin that plugs into the CEM Analyzer, that would be able to analyze those solid-element files.

The Language Server bases 95% of it's decisions on the data provided by the Custom Elements Manifest, therefore being able to query a CEM for solid elements would make them pretty much "pluggable" into the system with no sweat.

There are some examples on CEM plugins in the "official" repo of the analyzer https://github.com/open-wc/custom-elements-manifest/tree/master/packages/analyzer/src/features/framework-plugins

So in short:

Matsuuu commented 11 months ago

Support for JSX and solid html tag came in ver 1.0.0.

If you are making custom elements with Solid, we would require a CEM analyzer plugin to analyze them to get the full juice out of them.

If that's on the roadmap, I'd be happy to help