VS Code and Cocos Creator

I’ve recently started working with VS Code as my default editor for Cocos Creator. I am wondering what the Cocos Creator menu item ‘Developer/VS Code Workflow/Update VS Code API Source’ does. I clicked it when I installed VS Code to work with Cocos Creator. What does it do? And do I have to ‘Update the API source’ periodically?

The process copy a file named ‘creator.d.ts’ to your project directory. You can have a look at it. Basically a tons of function declaration that does nothing but commented with a format that allows VS Code to pick those up for descriptions. The function declared will be used for autocomplete and suggestions. Here’s a sample:

/** !#en
Outputs an error message to the Cocos Creator Console (editor) or Web Console (runtime).<br/>
- In Cocos Creator, error is red.<br/>
- In Chrome, error have a red icon along with red message text.<br/>
!#zh
输出错误消息到 Cocos Creator 编辑器的 Console 或运行时页面端的 Console 中。<br/>
- 在 Cocos Creator 中,错误信息显示是红色的。<br/>
- 在 Chrome 中,错误信息有红色的图标以及红色的消息文本。<br/>
@param obj A JavaScript string containing zero or more substitution strings.
@param subst JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. 
*/
export function error(obj : any, subst : any) : void;

Okay, thanks. :+1:

Missed out this. Yes for every release of CocosCreator you would need to ‘Update the API source’ periodically.

1 Like

Ok. Thanks!