-
Notifications
You must be signed in to change notification settings - Fork 395
Add the possibilty to manage suggestedCorrections property with a script rule #619
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
Comments
Yes, you can add SuggestedCorrections property. $correctionExtent = New-Object `
-TypeName 'Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.CorrectionExtent' `
-ArgumentList $startLineNumber,$endLineNumber,$startColumnNumber,$endColumnNumber,$replacementText,$filepath,$description
$result = New-Object -TypeName `
'Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.DiagnosticRecord' `
-ArgumentList "This is sample rule",$violationExtent,'rulename','warning','c:\tmp',$null,$correctionExtent As of now you cannot initialize If it helps, you can find a relevant |
@LaurentDardenne Thanks for the explanation! I now understand the issue. Yes, looks like something is lost while converting from PSObject to DiagnosticRecord in the Engine. |
Is this still on the radar? Seems like it would be fairly easy to fix and it would be great to provide custom formatting in vscode. Thanks! |
@LaurentDardenne Do I understand correctly that we can close this now because the root cause was fixed in #618? |
@bergmeister |
The issue 618 is fixed, but not this one. When i use the function outside PSscriptAnalyzer, this property is correctly assigned, but when PSscriptAnalyzer use my function this property is no more correctly assigned . |
Maybe this code is involved. |
Has this ever been fixed!? |
@Mcgurk125 |
@LaurentDardenne @Mcgurk125 I have a fix for this in my branch ready here and I will also make the property public to keep the construction of the DiagnosticRecord object easy as it is. PR with the fix is below: |
Thank you for the work done |
In the file ScriptRuleDocumentation.md, it is says :
It is possible to assign the suggestedCorrections property in a script, but the C# code do not assign this property.
The text was updated successfully, but these errors were encountered: