PSScriptAnalyzer not working correctly on Visual Studio Code

Created on 10 Aug 2018  路  5Comments  路  Source: PowerShell/PSScriptAnalyzer

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}

Most helpful comment

Thanks! I will!

All 5 comments

cc @tylerl0706 This seems to be rather an integration issue of PSES? I haven't checked if I can repro yet.

I can semi repro this

however on opening the second file, also a ps1 file, and then adding GC C:\dell\ to the file there was a delay in ScriptAnalzyer picking this up by at around 5 seconds or so (not accurately timed)

@kilasuit Yes, I have tested like you said and indeed there is a big delay... for me it took a lot more than 10 seconds.
But on the settings.json file even waiting for a long time it doesn't changes:
image

This looks like a PowerShell extension issue. You might want to reopen this issue here.

Thanks! I will!

Was this page helpful?
0 / 5 - 0 ratings