Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow formatting when ScriptAnalysis is off #1262

Conversation

TylerLeonhardt
Copy link
Member

fixes PowerShell/vscode-powershell#2543

With ScriptAnalysis turned off...

"powershell.scriptAnalysis.enable": false,

this disables PSScriptAnalyzer capabilities in the extension including:

  • "Problems" in your open editor file
  • Formatting

Since that was off, formatting wasn't working for users (and would throw a weird null ref due to returning null instead of Task.FromResult(null)).

With that said, I don't see why this needs to be the case. You should be able to run the formatter and have "Problems" turned off. This PR pushes the ScriptAnalysis enabled test up a layer while allowing the Formatting path to trigger the creation of the AnalysisEngine.

@TylerLeonhardt TylerLeonhardt requested a review from rjmholt April 16, 2020 21:00
Comment on lines 268 to 270
if (_analysisEngineLazy == null ||
(_pssaSettingsFilePath != null
&& !File.Exists(_pssaSettingsFilePath)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (_analysisEngineLazy == null ||
(_pssaSettingsFilePath != null
&& !File.Exists(_pssaSettingsFilePath)))
if (_analysisEngineLazy == null
|| (_pssaSettingsFilePath != null
&& !File.Exists(_pssaSettingsFilePath)))

@TylerLeonhardt
Copy link
Member Author

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- src/PowerShellEditorServices/Services/Analysis/PssaCmdletAnalysisEngine.cs  1
         

See the complete overview on Codacy

@TylerLeonhardt
Copy link
Member Author

just gonna give the person in the issue a chance to get back to me on if this fixed their issue.

@TylerLeonhardt TylerLeonhardt merged commit 765c76c into PowerShell:master Apr 17, 2020
@TylerLeonhardt TylerLeonhardt deleted the allow-formatting-when-scriptanalysis-is-off branch April 17, 2020 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting no longer works
2 participants