简体   繁体   English

如何为 TypeScript 配置 VSCode Intellisense 以仅显示属性?

[英]How do I configure VSCode Intellisense for TypeScript to display properties only?

I have an API which uses parameter objects and the only way to stay sane is to have intellisense.我有一个使用参数对象的 API,保持理智的唯一方法是拥有智能感知。

It works to an extent, but this is annoying.它在一定程度上有效,但这很烦人。

我不想要的东西清单

None the less, I see that the list does contain properties i want.尽管如此,我看到该列表确实包含我想要的属性。 How can I make this list only show my properties of the object, and not the kitchen sink?我怎样才能让这个列表只显示我的对象属性,而不是厨房水槽?

我只想要列表中的这些

If it isn't too clear, then basically, I don't want to cycle through a massive list of stuff, looking for analytics , I don't want to right click and go into this method searching what is available, and I don't want to seek docs either.如果不太清楚,那么基本上,我不想循环浏览大量内容,寻找analytics ,我不想右键单击并进入此方法搜索可用内容,我不想也不想寻找文档。 I just want the "properties" of an object to take priority.我只想优先考虑对象的“属性”。

These suggestions are coming from the auto import extension and not VS Code's standard JavaScript and TypeScript language features.这些建议来自自动导入扩展,而不是 VS Code 的标准 JavaScript 和 TypeScript 语言功能。 You can tell this by the [AI] in the suggestion item label您可以通过建议项标签中的[AI]来判断

VS Code has supported auto imports out of the box since 1.18 so this extension should no longer be required. 自 1.18 以来, VS Code 已支持开箱即用的自动导入,因此不再需要此扩展。 If the built-in auto imports aren't working properly, please file an issue如果内置的自动导入无法正常工作,请提出问题

Anyway, уou can also control your Intellisense preferences in Settings>Text Editor>Suggestions page:无论如何,您还可以在Settings>Text Editor>Suggestions页面中控制您的 Intellisense 首选项:

vs 代码文本编辑器显示属性建议隐藏单词

These days, it seems like at least the one you want is promoted to the top of the list.这些天来,似乎至少您想要的人被提升到列表的顶部。 However, you have to type the first letter to get the suggestion, which kind of ruins the "stay sane" part of your question IMO.但是,您必须输入第一个字母才能获得建议,这会破坏 IMO 问题中“保持理智”的部分。

I opened an issue for triggering autocomplete on { rather than waiting for a letter to be typed, here .我打开了一个问题,用于在{上触发自动完成,而不是在此处等待输入字母。

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

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