This repository was archived by the owner on Oct 16, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
src/AddIns/Misc/PackageManagement Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ void InitPowerShell()
126126 powerShellHost . SetRemoteSignedExecutionPolicy ( ) ;
127127 UpdateFormatting ( ) ;
128128 RedefineClearHostFunction ( ) ;
129+ DefineTabExpansionFunction ( ) ;
129130 UpdateWorkingDirectory ( ) ;
130131 }
131132
@@ -163,6 +164,15 @@ void RedefineClearHostFunction()
163164 powerShellHost . ExecuteCommand ( command ) ;
164165 }
165166
167+ void DefineTabExpansionFunction ( )
168+ {
169+ string command =
170+ "function TabExpansion($line, $lastWord) {" +
171+ " return New-Object PSObject -Property @{ NoResult = $true }" +
172+ "}" ;
173+ powerShellHost . ExecuteCommand ( command ) ;
174+ }
175+
166176 void WriteInfoBeforeFirstPrompt ( )
167177 {
168178 WriteNuGetVersionInfo ( ) ;
Original file line number Diff line number Diff line change 1818
1919using System ;
2020using System . Collections . Generic ;
21+ using System . Linq ;
2122using ICSharpCode . PackageManagement ;
2223using ICSharpCode . PackageManagement . Design ;
2324using ICSharpCode . PackageManagement . EnvDTE ;
2425using ICSharpCode . PackageManagement . Scripting ;
2526using ICSharpCode . Scripting ;
26- using ICSharpCode . Scripting . Tests . Utils ;
2727using NuGet ;
2828using NUnit . Framework ;
2929using PackageManagement . Tests . Helpers ;
@@ -673,5 +673,18 @@ public void SetDefaultRunspace_AfterHostIsRun_SetsDefaultRunspaceOnPowershellHos
673673
674674 Assert . IsTrue ( powerShellHost . IsSetDefaultRunspaceCalled ) ;
675675 }
676+
677+ [ Test ]
678+ public void Run_ConsoleExitsOnFirstRead_TabExpansionFunctionDefined ( )
679+ {
680+ CreateHost ( ) ;
681+ RunHost ( ) ;
682+
683+ string partialExecutedScript = "function TabExpansion" ;
684+
685+ bool executed = powerShellHost . AllCommandsPassedToExecuteCommand . Any ( command => command . Contains ( partialExecutedScript ) ) ;
686+
687+ Assert . IsTrue ( executed ) ;
688+ }
676689 }
677690}
You can’t perform that action at this time.
0 commit comments