英文:
Why doesn't WebStorm provide method documentation on the second level?
问题
我最近开始使用WebStorm,并注意到IDE有时在第二级不提供属性或方法的文档。因此,当我调用一个对象并尝试探索第二级的可用方法和属性时,没有显示文档或提示。它只显示"unresolved method"。
我已经尝试检查设置并确保我正在使用WebStorm的最新版本,但这没有解决问题。
有没有办法在WebStorm中更改这种行为,或者是我漏掉了什么?
我已经尝试启用"show full method signatures",那一度有效。然后它突然停止,回到没有文档。另外,我还尝试将JavaScript语言版本重置为ES 5.1,然后切回ES 6+。
英文:
I recently started to use WebStorm and I've noticed that the IDE sometimes doesn't provide property or method documentation on the second level. So, when I call an object and try to explore the available methods and properties on the second level, no documentation or hints are displayed. It only displays "unresolved method".
I've already tried checking the settings and making sure that I'm using the latest version of WebStorm, but that hasn't fixed the problem.
Is there a way to change this behavior in WebStorm or am I missing something?
I have tried to enable "show full method signatures" and that worked for a minute.
After that it suddenly stopped and went back to no documentation.
Also i have tried to reset the JavaScript language version to ES 5.1 and then back to ES 6+.
答案1
得分: 1
代码部分不要翻译。以下是翻译好的部分:
"The reason is that the exact type of event
parameter is unknown, so the type is inferred as generic Event
; EventTarget
interface doesn't have tagName
and getAttribute
properties. You need to explicitly tell the IDE the type of the HTMLElement which is your target using type annotations. See https://freshman.tech/snippets/typescript/fix-value-not-exist-eventtarget/"
翻译后:
"原因是 event
参数的确切类型未知,因此类型被推断为通用的 Event
; EventTarget
接口没有 tagName
和 getAttribute
属性。您需要明确告诉IDE您的目标是HTMLElement的类型,使用类型注释。请参阅 https://freshman.tech/snippets/typescript/fix-value-not-exist-eventtarget/。"
"For pure JavaScript, this can be done using JSDoc annotations"
翻译后:
"对于纯JavaScript,可以使用JSDoc注释来完成这个操作。"
英文:
The reason is that the exact type of event
parameter is unknown, so the type is inferred as generic Event
; EventTarget
interface doesn't have tagName
and getAttribute
properties. You need to explicitly tell the IDE the type of the HTMLElement which is your target using type annotations. See https://freshman.tech/snippets/typescript/fix-value-not-exist-eventtarget/
For pure JavaScript, this can be done using JSDoc annotations
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论