Sorry, I currently don’t have the time to write a more extensive answer, but here are some pointers into the right directions (in the hope that this already helps you). Besides that, I’ll elaborate on the answer a bit more in a few days when I have a bit more time…
To get autocompletion, you can use the Typescript Definitions (Typings) of the XD APIs, which are hosted in this GitHub repository: https://github.com/AdobeXD/typings.
It also discusses how it can be included in VSCode and WebStorm (even though there are also “newer” ways of doing it.
A few more details are also included in this thread about the topic: Adding autocompletion and linting in editors and IDEs
Personally, I usually use WebStorm with a project structure based on my open-source boilerplate, cf. https://github.com/pklaschka/xd-plugin-boilerplate…
I hope this already helps