Open jpzwarte opened 1 year ago
Minimal representation of a class that has a reflected prop/attribute: https://custom-elements-manifest.netlify.app/?source=CmNsYXNzIE15RWxlbWVudCBleHRlbmRzIEhUTUxFbGVtZW50IHsKICBzdGF0aWMgZ2V0IG9ic2VydmVkQXR0cmlidXRlcygpIHsKICAgIHJldHVybiBbJ3Byb3AnXTsKICB9CgogIHNldCBwcm9wKHZhbCkgewogICAgdGhpcy5fX3Byb3AgPSB2YWw7CiAgfQogIGdldCBwcm9wKCkgewogICAgcmV0dXJuIHRoaXMuX19wcm9wOwogIH0KfQoKY3VzdG9tRWxlbWVudHMuZGVmaW5lKCdteS1lbGVtZW50JywgTXlFbGVtZW50KTsK&library=null
As Custom Elements Language Server feeds through CEM instead of e.g. Lit specific tags, we need to acquire this info by checking if the field exists in both, thje attributes
and the members
of given class.
Having this kind of "code helper" is something that needs to be toggleable through settings as some developers might find it annoying.
On top of that, I'm not 100% if we can "intersect" the typing of the user, this needs to be looked at a bit before implementing. Another way to approach this would be through a code action, changing the attribute to a property, and vice versa.
On top of that, I'm not 100% if we can "intersect" the typing of the user, this needs to be looked at a bit before implementing. Another way to approach this would be through a code action, changing the attribute to a property, and vice versa.
Yeah, that would work as well. And I have you format-on-save in vscode, it would practically be the same.
<x-foo prop=${
and detect that you're entering an expression and auto-convert to<x-foo .prop=${
<x-foo .prop="x
and detect that you're entering a static attribute and auto-convert to<x-foo prop="x
Both depend on
@property({ reflect: true }) prop;