在 VS Code 中查找和禁用/过滤 DOM 智能感知建议 [英] Find and disable/filter DOM intelliSense recommendations in VS Code

查看:30
本文介绍了在 VS Code 中查找和禁用/过滤 DOM 智能感知建议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个空白/新的 .js 文件.出于某种原因,智能感知/自动完成会推荐我不认识也不知道它们来自哪里的东西.有没有办法完全删除这些建议(我永远不需要/使用它们),或者如何过滤/排除它们(全局、每个工作空间或扩展)?

I have a blank/new .js file. For some reason intelliSense/autocomplete is recommending things that I do not recognize nor do I know where they are coming from. Is there a way to either remove these recommendations entirely (I'll never need/use them) or some how filter/exclude them (either globally, per work-space, or by extension)?

这是我开始输入 doit 时看到的:

This is what I see when I start typing doit:

如果我选择/添加DocumentTimeline,然后CTRL+点击DocumentTimeline,我看到的是:

If I select/add DocumentTimeline and then CTRL+click on DocumentTimeline, this is what I see:

我不知道这是怎么来的?我不记得安装任何东西.我不想按类型过滤,因为有我想要的所有类型的有效建议.

I don't know how this got here? I don't recall installing anything. I don't want to filter by type as there are valid recommendations I want in all the types.

推荐答案

您可能希望在您的 jsconfig.json 文件中包含这样的内容:

You probably want something like this in your jsconfig.json file:

{
  "compilerOptions": {

      "lib": ["es6", "esnext"]  // or whatever in there, just not "dom"
      // intellisense will show you all the possible entries

   },
      "exclude": [
        "node_modules",
        "**/node_modules/*"
  ],
}

请参阅 github 问题:摆脱 DOM 类型.我假设 lib 选项是定义项目的上下文",并且在不限制它的情况下,如在上面的示例中,您获得的上下文"比您希望的要多得多,您将获得 dom 选项.

See github issue: getting rid of DOM types. I assume the lib option is "defining the context" of your project and without limiting it as in the example above you are getting much more "context" than you wish, you are getting the dom option.

通常请参阅 jsconfig 上的 vscode 文档.

这篇关于在 VS Code 中查找和禁用/过滤 DOM 智能感知建议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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