In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you the content of an example of VSCode automatic completion of js code. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.
How to automatically complete js Code by VSCode
Originally, only es native api has auto-completion in vscode, but it would be pitiful to use the related functions in node.js or its require.
Vscode can recognize typings, so typings can be used as a plug-in to expand the functionality of vscode.
The specific usage is as follows:
1. Configure jsconfig.json
Before using typings, you need to configure a file called jsconfig.json in vscode. The configuration method is simple. If you select any js file, a small green light bulb will pop up in the lower right corner of vscode, as shown in the figure:
2. Configure jsconfig.json
Click in, and the top will prompt
"Create a jsconfig.json to enable richer IntelliSense and code navigation across the entire workspace."
Select create,vscode to create a jsconfig.json file, which is roughly as follows:
{/ / See https://go.microsoft.com/fwlink/?LinkId=759670 / / for the documentation about the jsconfig.json format "compilerOptions": {"target": "es6", "module": "commonjs", "allowSyntheticDefaultImports": true}, "exclude": ["node_modules", "bower_components", "jspm_packages", "tmp" "temp"]}
All the required parameters will be set up for us. At this point, I am using the jsconfig generated by vscode v1.2.0, and the configuration automatically generated by the lower version may be a little less than that, but it does not affect it.
2. Install typings
Global installation of typings using npm
Npm install-g typings
3. Install the syntax plug-in
To install node.js auto-completion as an example, use bash or cmd in the project root directory, and type
Typings install dt~node-global
Where "dt~" means to use a DefinitelyTyped type definition, which vscode can recognize.
After that, you can see the new folder "typings" under the project directory.
Now type process, and it will be completed automatically. Under window, you may need to restart vscode to see the effect of automatic completion.
Thank you for reading! The example of VSCode automatic completion of js code is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.