Code Auto-Completion¶
Code auto-completion helps developers work faster and more comfortably with code, offering possible code completion options, variable names, functions, and other hints.
Below are the steps to configure code auto-completion for MotorXP-AFM Scripting API
.
Configuration¶
-
Download the file types_MotorXP-AFM.d.ts and save it in your scripts folder. The extension
.d.ts
is aTypeScript Declaration File
, which contains only type definitions and interfaces, and does not compile toJS
. It helps theIDE
understand the structure of theAPI
. -
At the beginning of each script add a special comment directive:
/// <reference path="./pathToFile/types_MotorXP-AFM.d.ts" />
. -
Utilize an
IDE
and editor that supports auto-completion (IntelliSense
through.d.ts
).
Supported IDEs¶
IDE / Editor | Supports .d.ts |
Comment |
---|---|---|
Visual Studio Code | ✅ Complete | Best IntelliSense, auto-completion, JSDoc, and navigation support |
WebStorm / IntelliJ IDEA | ✅ Complete | Support through TypeScript Server |
Vim + TSServer | ⚠️ Limited | Requires plugins: vim-js-ts , coc.nvim and others. |
Atom + ide-typescript | ⚠️ Limited | Requires package installations. |
Sublime Text + TypeScript Plugin | ⚠️ Limited | Available through third-party plugins |
Tip
When writing scripts, we recommend using a text editor Visual Studio Code
.