VSCode Intellisense 对 Javascript 代码的奇怪自动完成 [英] VSCode Intellisense weird autocompletion on Javascript code

查看:33
本文介绍了VSCode Intellisense 对 Javascript 代码的奇怪自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用 VSCode 编写 JS 文件时遇到了一些奇怪的行为.

I just ran into some strange behavior using VSCode writing a JS file.

看到我正在尝试访问蓬松对象上的 hasOwnProperty() 方法.并且 VSCode 没有自动完成或在我的代码行中提出任何建议.

See that I'm trying to access the hasOwnProperty() method on the fluffy object. And VSCode didn't autocomplete or suggest anything on my line of code.

此时我已经在想我做错了什么,我可能无法通过我的对象访问这个方法.

但有趣的是:

问题:

一旦完成输入 hasOwnProperty 并且我打开括号,VSCode 就会触发 IntelliSense 并识别该方法.正常吗?为什么 VSCode 没有显示我输入的第一个字母后可用于我的对象的所有属性和方法?

As soon as a finish typing hasOwnProperty and I open the parenthesis, VSCode triggers the IntelliSense and recognizes the method. Is it normal? How come VSCode doesn't show me all the properties and methods available to my object since the first letter that I've typed?

预先感谢您的帮助.

VSCode 关于:版本:1.25.1日期:2018-07-11T15:43:53.668Z电子:1.7.12铬:58.0.3029.110Node.js:7.9.0V8:5.8.283.38架构:x64

VSCode About: Version: 1.25.1 Date: 2018-07-11T15:43:53.668Z Electron: 1.7.12 Chrome: 58.0.3029.110 Node.js: 7.9.0 V8: 5.8.283.38 Architecture: x64

推荐答案

是的,这是意料之中的.我们不会为 Object.prototype 属性显示智能感知建议,因为它们几乎会出现在每个对象上,因此不是很有用.然而,语言智能确实知道 hasOwnProperty 存在,这就是为什么你会得到签名帮助

Yes this is expected. We don't show intellisense suggestions for Object.prototype properties because they would show up on pretty much every object and are therefore not very useful. However the language smarts do know that hasOwnProperty exists, which is why you get signature help for it

这篇关于VSCode Intellisense 对 Javascript 代码的奇怪自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆