【问题标题】:VS Code Error: (this.configurationService.getValue(...) || []).filter is not a functionVS 代码错误:(this.configurationService.getValue(...) || []).filter 不是函数
【发布时间】:2021-08-07 18:15:38
【问题描述】:

我刚开始在 VS Code 中遇到此错误,导致我无法创建新文件甚至无法打开文件。 VS Code 显示的弹出错误是(this.configurationService.getValue(...) || []).filter is not a function

这个错误/错误甚至阻止我打开扩展选项卡或启动基本热键。其他人有这个问题吗?

【问题讨论】:

  • 使用调试器找出this.configurationService.getValue(…)返回的内容

标签: python json debugging visual-studio-code


【解决方案1】:

我遇到了同样的问题。

在 settings.json 中发现了一些错误。试着检查一下,让我知道情况如何。

每次我尝试创建新文件时都会弹出此错误提示

"(this.configurationService.getValue(...) || []).filter 不是 函数”

就我而言,我必须将“workbench.editorAssociations”标志修复为:

"workbench.editorAssociations": [
    {
        "viewType": "jupyter-notebook",
        "filenamePattern": "*.ipynb"
    }
],

以前是:

"workbench.editorAssociations": {
    "*.ipynb": "jupyter-notebook"
}

【讨论】:

  • 非常感谢!不敢相信。 VS Code 不能在一个系统上运行,但不能在另一个系统上运行,我非常困惑。几个月前我有这个配置,现在它困扰着我。甚至无法打开该死的扩展程序。
  • settings.json 每次我重新启动机器时都会一直重置,如果你也能帮忙的话
  • 我的 settings.json 中有一些错误,所有这些我都已修复。但似乎,其中,我对“workbench.editorAssociations”的配置与您的配置完全相同。我认为 jupyter notebooks 最近坏了一些东西,只修复这个可能就足够了......
【解决方案2】:

我发现错误中的问题来自 VS Code 的 settings.json(在此处为 mac ~/Library/Application Support/Code/User/settings.json 找到)。有一个更新的扩展更新了一个错误。我的特别的似乎来自这一行:

"workbench.editorAssociations": { "*.ipynb": "jupyter.notebook.ipynb" }

无论如何,希望这对将来的某人有所帮助!

【讨论】:

  • 替换 this thread 的标志也解决了这个问题——看起来稳定版和内部版本之间的设置同步也导致了这个问题。
【解决方案3】:

在我在 Visual Studio Code(稳定版)和“Visual Studio Code - Insiders”之间同步我的设置后发生。

对我来说,这个错误导致 Jupyter 笔记本无法在 Visual Studio Code 中打开。

按照this comment 的建议和上面的答案所暗示的替换 Jupyter 笔记本设置对我不起作用。

对我有用的是删除 settings.json 中所有与 Jupyter 相关的条目。

【讨论】:

    【解决方案4】:

    我遇到了同样的错误,jupyter-notebook 扩展已更新并导致错误。

    在设置中导航到"workbench.editorAssociations"

    替换

     "*.ipynb": "jupyter-notebook"
    

     "viewType": "jupyter-notebook",
     "filenamePattern": "*.ipynb"
    

    一切都会好起来的。

    对于设置文件,

    默认情况下 VS Code 显示设置编辑器,但您仍然可以编辑 使用打开设置 (JSON) 的基础 settings.json 文件 命令或通过更改默认设置编辑器 workbench.settings.editor 设置。

    根据您的平台,用户设置文件位于此处:

    Windows %APPDATA%\Code\User\settings.json

    macOS $HOME/Library/Application Support/Code/User/settings.json

    Linux $HOME/.config/Code/User/settings.json

    【讨论】:

      【解决方案5】:

      在 Vscode 中的 Windows 中出现错误 "(this.configurationService.getValue(...) || []).filter is not a function"

      TL:DR;

      删除 Windows 中的 "workbench.editorAssociations": { "*.ipynb": "jupyter.notebook.ipynb" } 从 settings.json 中(在 Linux Ubuntu 中它可以工作,你可以保持原样)。

      • 与此处其他人所说的解决方案相同
      • 接下来:我同时使用git versionsettings.json这两种环境,所以我最好将其删除以避免错误并能够读取文件。
      • Linux 是 Windows 中出现错误的原因。

      【讨论】:

        猜你喜欢
        • 2017-05-09
        • 1970-01-01
        • 1970-01-01
        • 2021-12-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-01-25
        • 1970-01-01
        相关资源
        最近更新 更多