Skip to content

PSScriptAnalyzer not working correctly on Visual Studio Code #1054

Closed
@vandreytrindade

Description

@vandreytrindade

Before submitting a bug report:

  • Make sure you are able to repro it on the latest released version
  • Perform a quick search for existing issues to check if this bug has already been reported

Steps to reproduce

  • Open Visual Studio Code
  • Create a new PowerShell file
  • Press CTRL+SHIFT+P and select PowerShell: Select PSScriptAnalyzer rules
    The list is shown... If you type in the new file: "gc C:\Dell", it highlightes the "gc" command correctly.
  • Then open an existent file on Visual Studio Code
  • Press CTRL+SHIFT+P and select PowerShell: Select PSScriptAnalyzer rules
    Nothing happens and typing "gc" or any other command that triggers PSScriptAnalyzer, is not working anymore... I have to close Visual Studio Code.
  • Trying to configure settings.json using this:
    "powershell.scriptAnalysis.settingsPath": "c:\users\lee\PSScriptAnalyzerSettings.psd1"
    the first part doesn't turn blue (accepeted command) and it returns something like path not found.

Expected behavior

  • Automatically start analyzing the code on any file new or opened.
  • Being able to configure settings.json

Actual behavior

  • Not being able to use PSScriptAnalyzer
  • Not being able to configure it using settings.json

Environment data

> Name                           Value
----                           -----
PSVersion                      5.1.17134.165
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17134.165
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

>     Diretório: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.17.1     PSScriptAnalyzer                    {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-Formatter}

    Diretório: C:\Users\vpereira\.vscode\extensions\ms-vscode.powershell-1.8.2\modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.17.1     PSScriptAnalyzer                    {Get-ScriptAnalyzerRule, Invoke-ScriptAnalyzer, Invoke-Formatter}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions