PowerShell / PowerShell/vscode-powershell

PSScriptAnalyzer not working correctly on Visual Studio Code

Aperta
#1,476 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Area-Script Analysis Area-Threading Issue-Bug Issue-Performance
Lingua principale
TypeScript
Stelle
1.9k
Fork
548
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

System Details
  • Operating system name and version: Windows 10 1803 build 17134.191
  • VS Code version: 1.25.1
  • PowerShell extension version: 1.17.1
  • Output from $PSVersionTable:
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

More information:

code -v
1.25.1
1dfc5e557209371715f655691b1235b6b26a06be
x64

$pseditor.EditorServicesVersion
code --list-extensions --show-versions

$PSVersionTable
1.25.1
1dfc5e557209371715f655691b1235b6b26a06be
x64

Major  Minor  Build  Revision
-----  -----  -----  --------
1      8      2      0
emmanuelbeziat.vscode-great-icons@2.1.39
ms-vscode.PowerShell@1.8.2

Key   : PSVersion
Value : 5.1.17134.165
Name  : PSVersion

Key   : PSEdition
Value : Desktop
Name  : PSEdition

Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name  : PSCompatibleVersions

Key   : BuildVersion
Value : 10.0.17134.165
Name  : BuildVersion

Key   : CLRVersion
Value : 4.0.30319.42000
Name  : CLRVersion

Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion

Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion
Issue Description

I have opened an issue on the PSScriptAnalyzer github page, and they told me to post it here:
Link to the Issue

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

image

  • Environment data:
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}
Attached Logs

Follow the instructions in the README
about capturing and sending logs.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il malfunzionamento in Visual Studio Code con le versioni elencate di PowerShell, dell’estensione e di PSScriptAnalyzer, quindi esamina il problema collegato di PSScriptAnalyzer e l’integrazione dell’analisi dell’estensione. Il lavoro è completato quando l’analisi funziona sia per i file nuovi sia per quelli aperti e la configurazione settingsPath viene accettata senza errori relativi al percorso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
powershell, typescript, vscode
Ambito
devtools, tooling
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.