Visual Studio 2022 suggestions for dotvvm front-end object and its members

Hello,

So we are dealing now with migrating/adapting blocks of javascript from WebForms UserControls and pages into DotVVM pages and MarkupControls. And I cannot manage to make suggestions/Intellisense become available for the front-end dotvvm framework in the markup file of a MarkupControl:

image

I’ve searched the repo samples and did not find anything to help with this. I’ve found about the @js directive that seems promising but how to use this with the dotvvm object? Is there a *.map file somewhere that we can use? I’ve run out of ideas.

In WebForms we had this trick which gave us all the suggestions/Intellisense of what we specified as import:
image

image

Sincerely,
Marian

I’ve tried with the RequiredResource control. No luck.

image

I don’t know how does VS JavaScript autocompletion works, I don’t think the DotVVM extension does anything with it. You can install the typescript type definitions package - TypeScript declarations | DotVVM Documentation, I suppose it may also add the global symbol to autocompletion in inline JS.

The RequiredResource controls only enforce that a specific script is included in the page. Since dotvvm and dotvvm.internal are always included, you can safely delete those. dotvvm.businesspack is automatically included when you use a BP control. dotvvm.debug is always included in debug mode, you most likely don’t want it in production (it display the red notification when a postback does not run, for example). I think you can remove them all.

The Dependencies also enforces that the resources are included in page, but also makes sure to place the InlineScript after the specified resources, so I’d keep that.

Sure, I appreciate your detailed and considered explanation from which I’ve learned something useful. But the RequiredResource image example was just my desperate attempt at maybe getting the intellisense to give me something for dotvvm object in JS.

I will see about this and get back with feedback…

I am now dealing with this

So this resolves it:

Source: typescript - tsconfig.json: Build:No inputs were found in config file - Stack Overflow

This created another .js file and these 2 files exist just for the sake of build to work.
image

Do you know an alternative for this?

PS: my tsconfig.json:
image

The intellisense is not working while the documentation page states it should…

What am I missing here?

I’ve managed to squeeze some intellisense by doing an import:
image

But it seems I’m on a wrong path because I am not able to find the events themselves (in the picture we cannot see any init or initCompleted in the list).

OK, so I’ve managed to obtain the intellisense for the dotvvm object and its members:
image

BUT! This is inside a .ts file. Instead I need the intellisense in the markup files (.dothtml ; .dotcontrol). Is my requirement feasible?

Alright, after some great fiddling and jiggling and without any further ado,
I present you my nuggety-brown hackish-workaround :brain: :clap: :

If anybody happens to know a better way, please let me know.