Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize automatic completion by vscode

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to achieve automatic completion of vscode, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Automatic completion (Smart Tip)

Because Microsoft launched the typescript language before, combined with tsd files, it is quite cool to write typescript code with visual studio, and the intelligent prompt function is very nb.

This feature should also be inherited by vsc.

The automatic completion of vsc uses typings.

The TypeScript Definition Manager (the previous tsd has been deprecated, which is explained in faq)

Https://github.com/typings/typings

It's a lot like npm, isn't it?

At present, the mainstream front-end class libraries / frameworks, including node.js and its modules / frameworks, have corresponding tsd files, which can be found on typings.

Then you can install typings and use the

Npm install typings-globalcd vsc-doctypings install dt~node-global-savetypings install express-ambient-save

It's a lot like npm, isn't it?

At this point, take a look at the current directory, the following express.d.ts file is for specific prompts.

Typings/express/express.d.ts

In the code editing area, type CTRL+SPACE (the default shortcut key) and you will be prompted.

The current version of node.d.ts is still 0.12.0, which is not much different from the api of node v4 (the latest version is 4.x).

Why is there no code hint?

In the package.json directory.

Typings install node-ambient-save

Then add comments to the app.js file, reference typings, and there is a code hint.

/ var http = require ("http") / / http.http.cr

The details are as follows:

You can also hit CTRL+SPACE and get intellisense.

If it is repeated changes, still can not prompt (I am good, I deleted jscongfig.json, and then vsc has not been prompted, no matter how to do it), please restart.

Why not use tsd?

Https://github.com/DefinitelyTyped/tsd

Officials say:

DEPRECATED: TSD is deprecated, please use Typings and see this issue for more information. Thank you for reading this article carefully. I hope the article "how to achieve automatic completion of vscode" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report