My current project has some last struggled with regards to type detection. And since there is no plugin that fits my needs i'm thinking about creating one. I know visual studio code plugins can do a lot of interesting things. I'm using javascript to render HTML code, such a snippet looks like this:
class TestComponent extends ComponentBase
{
/** @type { SomePropertyType } */ someProperty;
render(){
return html`
<my-component .complex-attribute="${this.someProperty}"></my-component>
`;
}
}
class MyComponent extends ComponentBase
{
/** @type { ComplexType } */ complexAttribute;
}
now i want to write a VSCode plugin that forces the IDE to:
- detect that the complex-attribute is of type "ComplexType"
- that you can click on complex-attribute to be navigated to the line where the property is defined
- that, if the type you pass to the attribute is not any and not "ComplexType" i will get a compiler error
- that if the type is any, it will be implicitly converted into "ComplexType"
is this possible? and if yes how can i even get started doing that?
again to clarify: this is not about javascript type checking. this is about parsing a string you prompt using javascript and adding specific types to parts of it.