简体   繁体   English

了解Vscode中的Intellisense

[英]Understanding Intellisense in Vscode

I am new to nodejs and started using vscode recently but pretty good with Javascript and its wonderful features. 我是nodejs的新手,最近开始使用vscode,但Javascript及其出色的功能相当不错。 I am having some trouble understanding the parameters that the intellisense is showing. 我在理解智能感知显示的参数时遇到了一些麻烦。

在此处输入图片说明

What exactly does this line mean, this intellisense is so confusing!. 这句话到底是什么意思,这种智能感知是如此令人困惑! Is there some extension that I can install which will give the boiler plate code if I want to use for eg: watch method. 如果我想用于例如:watch方法,是否可以安装一些扩展名,该扩展名将提供样板代码。

Thanks and please dont down vote, this is a genuine question as to how to make sense of the intellisence. 谢谢,请不要拒绝投票,这是一个关于如何理解才智的真正问题。

Thanks 谢谢

listener?: (event: string, filename: string) => any

From left to right: 从左到右:

  • fs.watch accepts an optional argument listener (the ? indicates this) fs.watch接受可选的参数listener?表示此)
  • listener should be a function accepting two parameters: event and filename . listener应该是一个接受两个参数的functioneventfilename (Technically you could write a function that doesn't accept any, but you'd lose information) (从技术上讲,您可以编写不接受任何函数,但会丢失信息的函数)
  • listener doesn't need to return anything ( => any ) listener器不需要返回任何内容( => any

There's more information here , including how VS Code actually generates this annotations. 还有更多的信息在这里 ,包括VS代码实际上是如何产生这个注解。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM