From a0669d0614762264db3ffc1e30c946ccbe1130bb Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Tue, 16 Apr 2019 12:24:53 -0700 Subject: [PATCH 1/3] Missed test case --- test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 index f48a66acf99..b4753d01791 100644 --- a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 +++ b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 @@ -485,6 +485,7 @@ Describe "TabCompletion" -Tags CI { @{ inputStr = '$A=[datetime]::now;$A.'; expected = 'Date'; setup = $null } @{ inputStr = 'try { 1/0 } catch {};$error[0].'; expected = 'CategoryInfo'; setup = $null } @{ inputStr = '$x= gps pwsh;$x.*pm'; expected = 'NPM'; setup = $null } + @{ inputStr = 'function Get-ScrumData {}; Get-Scrum'; expected = 'Get-ScrumData'; setup $null } @{ inputStr = 'function write-output {param($abcd) $abcd};Write-Output -a'; expected = '-abcd'; setup = $null } @{ inputStr = 'function write-output {param($abcd) $abcd};Microsoft.PowerShell.Utility\Write-Output -'; expected = '-InputObject'; setup = $null } @{ inputStr = '[math]::Co'; expected = 'Cos('; setup = $null } From 3f2c9c5a25e65cd0ed0e939cb07161d7ba3410d1 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Tue, 16 Apr 2019 13:21:51 -0700 Subject: [PATCH 2/3] typo... --- test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 index b4753d01791..06f29a40b1e 100644 --- a/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 +++ b/test/powershell/Host/TabCompletion/TabCompletion.Tests.ps1 @@ -485,7 +485,7 @@ Describe "TabCompletion" -Tags CI { @{ inputStr = '$A=[datetime]::now;$A.'; expected = 'Date'; setup = $null } @{ inputStr = 'try { 1/0 } catch {};$error[0].'; expected = 'CategoryInfo'; setup = $null } @{ inputStr = '$x= gps pwsh;$x.*pm'; expected = 'NPM'; setup = $null } - @{ inputStr = 'function Get-ScrumData {}; Get-Scrum'; expected = 'Get-ScrumData'; setup $null } + @{ inputStr = 'function Get-ScrumData {}; Get-Scrum'; expected = 'Get-ScrumData'; setup = $null } @{ inputStr = 'function write-output {param($abcd) $abcd};Write-Output -a'; expected = '-abcd'; setup = $null } @{ inputStr = 'function write-output {param($abcd) $abcd};Microsoft.PowerShell.Utility\Write-Output -'; expected = '-InputObject'; setup = $null } @{ inputStr = '[math]::Co'; expected = 'Cos('; setup = $null } From 9f632ec7d1991dd9c5c4e5fa69765b3d7a7b2077 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Tue, 16 Apr 2019 18:32:47 -0700 Subject: [PATCH 3/3] fix test --- .../engine/CommandCompletion/CompletionCompleters.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs index d117e09428a..5c6d11c96c4 100644 --- a/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs +++ b/src/System.Management.Automation/engine/CommandCompletion/CompletionCompleters.cs @@ -103,6 +103,9 @@ private static List CompleteCommand(CompletionContext context, if (lastAst != null) { + // We need to add the wildcard to the end so the regex is built correctly. + commandName += "*"; + // Search the asts for function definitions that we might be calling var findFunctionsVisitor = new FindFunctionsVisitor(); while (lastAst.Parent != null)