Skip to content

Commit 921c1d2

Browse files
Jos KoelewijnJos Koelewijn
Jos Koelewijn
authored and
Jos Koelewijn
committed
fix build for windows powershell
1 parent e5e6a58 commit 921c1d2

File tree

4 files changed

+31
-6
lines changed

4 files changed

+31
-6
lines changed

Diff for: .vscode/extensions.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// for the documentation about the extensions.json format
44
"recommendations": [
55
"ms-vscode.PowerShell",
6-
"ms-vscode.csharp",
6+
"ms-dotnettools.csharp",
77
"ms-vscode-remote.remote-containers"
88
]
99
}

Diff for: .vscode/launch.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4-
4+
{
5+
"name": "PowerShell Launch Current File",
6+
"type": "PowerShell",
7+
"request": "launch",
8+
"script": "${file}",
9+
"cwd": "${file}"
10+
},
511
{
612
"name": ".NET Core Launch (console)",
713
"type": "coreclr",
@@ -27,4 +33,4 @@
2733
"processId": "${command:pickProcess}"
2834
}
2935
]
30-
}
36+
}

Diff for: Rules/UseUsingScopeModifierInNewRunspaces.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public string GetSourceName()
9292
#if !(PSV3 || PSV4)
9393
internal class SyntaxCompatibilityVisitor : AstVisitor2
9494
#else
95-
private class SyntaxCompatibilityVisitor : AstVisitor
95+
internal class SyntaxCompatibilityVisitor : AstVisitor
9696
#endif
9797
{
9898
private const DiagnosticSeverity Severity = DiagnosticSeverity.Warning;

Diff for: build.psm1

+21-2
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,12 @@ function Start-ScriptAnalyzerBuild
289289
function Test-ScriptAnalyzer
290290
{
291291
[CmdletBinding()]
292-
param ( [Parameter()][switch]$InProcess, [switch]$ShowAll )
292+
param(
293+
[Parameter()]
294+
[switch]$InProcess,
295+
[switch]$ShowAll,
296+
[String]$RuleToTest
297+
)
293298

294299
END {
295300
# versions 3 and 4 don't understand versioned module paths, so we need to rename the directory of the version to
@@ -319,7 +324,12 @@ function Test-ScriptAnalyzer
319324
$testModulePath = Join-Path "${projectRoot}" -ChildPath out
320325
}
321326
$testResultsFile = "'$(Join-Path ${projectRoot} -childPath TestResults.xml)'"
322-
$testScripts = "'${projectRoot}\Tests\Engine','${projectRoot}\Tests\Rules','${projectRoot}\Tests\Documentation'"
327+
if ($RuleToTest) {
328+
$testScripts = "${projectRoot}\Tests\Rules\$RuleToTest"
329+
}
330+
else {
331+
$testScripts = "'${projectRoot}\Tests\Engine','${projectRoot}\Tests\Rules','${projectRoot}\Tests\Documentation'"
332+
}
323333
try {
324334
if ( $major -lt 5 ) {
325335
Rename-Item $script:destinationDir ${testModulePath}
@@ -704,3 +714,12 @@ function Copy-CrossCompatibilityModule
704714
}
705715
}
706716
}
717+
718+
Function RuleNameCompleter {
719+
param($commandName, $parameterName, $wordToComplete, $commandAst, $fakeBoundParmeter)
720+
721+
Get-Childitem -Path "${projectRoot}\Tests\Rules" -Filter "*$wordToComplete*.tests.ps1" -Name |
722+
ForEach-Object { New-Object System.Management.Automation.CompletionResult $_ }
723+
}
724+
725+
Register-ArgumentCompleter -CommandName 'Test-ScriptAnalyzer' -ParameterName 'RuleToTest' -ScriptBlock $Function:RuleNameCompleter

0 commit comments

Comments
 (0)