小编Tuo*_*uor的帖子

VS Code Python 无法识别匹配语句

当我在 VS Code 中使用 Python 中的匹配大小写语句时,它会在“问题”选项卡中显示红色波浪线和错误:

如上所述 VS Code 的屏幕截图

python python-jedi visual-studio-code vscode-python python-3.10

19
推荐指数
1
解决办法
1万
查看次数

在 Visual Studio Code 中构建 powershell 模块时出现“InvalidOperation:无法在管道中间运行文档:”错误

问题描述

当我在 Visual Studio Code 1.58.2 中的模块 SampleModule.psm1 上选择“运行而不调试”时

function ConvertTo-PascalCase([String []] $words) {
    [String] $pascalCaseString = [String]::Empty

    foreach ($word in $words) {
        $pascalCaseString = $pascalCaseString + ($word.Substring(0,1).ToUpper() + $word.Substring(1))
    }
    $pascalCaseString = ($pascalCaseString.TrimEnd(',')).Trim()
    
    return $pascalCaseString
}

Export-ModuleMember -Function Convert-ToPascalCase
Run Code Online (Sandbox Code Playgroud)

我不断收到错误消息:

InvalidOperation:无法在管道中间运行文档

屏幕截图更详细地显示了它。每当我构建任何模块时,我都会收到同样的错误消息

vscode 运行 *.psm1 文件时出现错误消息

我尝试过但不起作用的事情

  1. 在 VSCode 中检查我的 PowerShell 扩展及其设置
  2. 在 VSCode 中使用不同的 PowerShell 版本
  3. 包含清单没有什么区别
  4. 研究错误消息以获取有关其在这种特定情况下的含义的更多详细信息
  5. 检查我的 VSCode 终端环境的配置

我如何知道这是运行 PSM1 文件的问题

如果我将 .psm1 模块文件转换回普通的旧 Powershell 脚本 (*.ps1) 脚本并删除所有Export-Module 成员命令,则脚本运行得很好。

我的工作

要在 VSCode 中执行该模块,我必须使用 dotsource 才能成功导入该模块: …

powershell powershell-module visual-studio-code

7
推荐指数
1
解决办法
8366
查看次数

用 Scoop 更新 pwsh?

当尝试使用 scoop via 更新 Powershell Core 时scoop update pwsh,出现以下错误:
ERROR Application "pwsh" is still running. Close all instances and try again.
我尝试关闭 PowerShell 并更新 via cmd,但它仍然引发该错误。

powershell powershell-core scoop-installer

7
推荐指数
1
解决办法
2019
查看次数

VSCode Arduino 找不到 Arduino CLI?

我正在使用(尝试)带有 arduino-cli 的 VSCode Arduino 扩展。当尝试编译草图时,它会抛出以下错误:

Cannot find Arduino IDE. Please specify the "arduino.path" in the User Settings. Requires a restart after change.
Run Code Online (Sandbox Code Playgroud)

这是以下的输出arduino-cli version

arduino-cli.exe  Version: 0.21.1 Commit: 9fcbb392 Date: 2022-02-24T15:41:45Z
Run Code Online (Sandbox Code Playgroud)

这些是所有arduino.设置settings.json

Cannot find Arduino IDE. Please specify the "arduino.path" in the User Settings. Requires a restart after change.
Run Code Online (Sandbox Code Playgroud)

arduino visual-studio-code arduino-cli

5
推荐指数
1
解决办法
4737
查看次数