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

Integrated terminal needs multi-line input support #569

Closed
ChrisLynchHPE opened this issue Mar 16, 2017 · 16 comments
Closed

Integrated terminal needs multi-line input support #569

ChrisLynchHPE opened this issue Mar 16, 2017 · 16 comments
Labels
Area-Extension Terminal Issue-Enhancement A feature request (enhancement).

Comments

@ChrisLynchHPE
Copy link

System Details

  • Operating system name and version: Windows 10.15058 (Insiders Fast Ring)
  • VS Code version: 1.10.2
  • PowerShell extension version: 0.10
  • Output from $PSVersionTable:
Name                           Value
----                           -----
PSVersion                      5.1.15058.0
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.15058.0
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I have a Hashtable in my PowerShell module, and the new terminal in 0.10 does not work correctly like it used to. Paste the following into the Terminal:

$MyHT = @{
   key1 = 'value1';
   key2 = 'value2
}

And you will get the following output:

PS C:\Users\chris> $MyHT = @{
The hash literal was incomplete.
At line:0 char:0
PS C:\Users\chris>    key1 = 'value1';
key1 : The term 'key1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
At line:1 char:4
+    key1 = 'value1';
+    ~~~~
    + CategoryInfo          : ObjectNotFound: (key1:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

PS C:\Users\chris>    key2 = 'value2
The string is missing the terminator: '.
At line:0 char:0
PS C:\Users\chris> }

Not only does one get the exceptions above, but the terminal is extremely slow. I don't know if it's because of the loaded PSM1 file I have (which is more than 80k lines, and 2.2MB in size).

Attached Logs

When I enable plugin verbose logging, powershell.exe will terminate and I can't then reproduce the issue:

powershell.exe started --
    pid: 940
    exe: C:\WINDOWS\Sysnative\WindowsPowerShell\v1.0\powershell.exe
    args: C:\Users\chris\.vscode\extensions\ms-vscode.PowerShell-0.10.0\scripts\Start-EditorServices.ps1 -EditorServicesVersion '0.10.0' -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '0.10.0' -BundledModulesPath 'C:\Users\chris\.vscode\extensions\ms-vscode.PowerShell-0.10.0\modules' -EnableConsoleRepl -LogLevel 'Verbose' -LogPath 'C:\Users\chris\.vscode\extensions\ms-vscode.PowerShell-0.10.0\logs\1489692702-86da6b33-6d62-41a2-a912-eb66f3cd355a1489692658699\EditorServices.log' -SessionDetailsPath 'C:\Users\chris\.vscode\extensions\ms-vscode.PowerShell-0.10.0\sessions\PSES-VSCode-12712' 



powershell.exe terminated or terminal UI was closed

Could not start language service: 
Timed out waiting for session file to appear.

(the log file generated contains the text I pasted above.)

@daviwil daviwil changed the title Copy and Paste Hashtable or PSCustomObject with multiple lines into Terminal does not paste literal Integrated terminal needs multi-line input support Mar 16, 2017
@daviwil
Copy link
Contributor

daviwil commented Mar 16, 2017

Hey Chris, this is happening because I haven't added support for multi-line input. I'll try to get this in for 0.10.2.

@daviwil daviwil added this to the 0.10.2 milestone Mar 16, 2017
@daviwil daviwil added the Issue-Bug A bug to squash. label Mar 16, 2017
@ChrisLynchHPE
Copy link
Author

Ah, okay. Also, any idea on why the powershell process would be so slow on my Surface Pro 3 Core i5/256 system? If I terminate the integrated console or PowerShell session in VSCode, overall performance dramatically improves. I don't have any similar perf issues with PowerShell outside of VSCode.

@Jaykul
Copy link

Jaykul commented Mar 17, 2017

Multi-line badly needed. Also, text navigation in input, like Ctrl+Left or Ctrl+Shift+Left or Ctrl+A or Ctrl+Backspace ;-)

@daviwil
Copy link
Contributor

daviwil commented Mar 17, 2017

I was trying to decide whether I should add text navigation or let PSReadline take care of it once I get that integration working. Since that may take a little while, maybe it's better to get some basic navigation hotkeys working?

@bgelens
Copy link

bgelens commented Mar 17, 2017

Yes please 👍 Heavy user of ctrl+left and ctrl+right myself

@Jaykul
Copy link

Jaykul commented Mar 18, 2017

If PSReadLine integration was easy, that's obviously very nice ;-) But basic multi-line and text editor cursor movement keys would go a long way toward making a long wait comfortable ;-)

@daviwil daviwil modified the milestones: 0.12.0, 0.10.2 Mar 23, 2017
@daviwil daviwil modified the milestones: 0.12.0, Next Patch Update, Next Feature Update Apr 4, 2017
@daviwil daviwil modified the milestones: April 2017, May 2017 May 8, 2017
@daviwil daviwil modified the milestones: May 2017, June 2017 Jun 1, 2017
@daviwil daviwil removed this from the June 2017 milestone Jul 11, 2017
@benpiper
Copy link

Please make it so!

@daviwil daviwil modified the milestones: July 2017, Future Oct 26, 2017
@TylerLeonhardt TylerLeonhardt added Issue-Enhancement A feature request (enhancement). and removed Issue-Bug A bug to squash. labels Dec 6, 2017
@el-chazmo
Copy link

This still doesn't work in v1.18.1 Is this in the timeline?

@TylerLeonhardt
Copy link
Member

@el-chazmo thanks for your patience! This will be fixed when the Integrated Terminal supports PSReadline. @SeeminglyScience has been working hard on adding it. I don't have a timeline but he might be able to supply one. Or to supply an update.

@Jaykul
Copy link

Jaykul commented Jul 10, 2018

+Label AintGonnaDoIt☹️

Can we agree that after supposedly trying to get PSReadLine integrated for over a year, it's long past time to improve your own input? I mean: how many people actually type in that console, the way it is?

Nobody on my team will use the interactive debugger, because working in that terminal is frustrating.

@SeeminglyScience
Copy link
Collaborator

@Jaykul It's mostly done, PR is PowerShell/PowerShellEditorServices#672 if you want to try it out 😀

@CollinChaffin
Copy link

The Posh masses really need to STOP posting on every blog how vscode is in ANY way the "best" Posh editor/IDE to be using (as of today). I commend the effort but I cannot fathom anyone coming from a real Posh background using IDEs like Pstudio/Primalforms/conemu with npp/posh split-screened or heck - how about just plain old Notepad++ with powershell.exe opened below it for that matter calling vscode a step-up.

I'm trying to understand this part of over a full YEAR of "waiting for psReadline" to work. Have you taken a look at something like ConEmu, who's darned source code is openly posted for you to review, and since that single individual developer DID manage to quickly get FAR BEYOND psreadline usability, and in fact successfully process every single Posh (and heck, you can literally flip the script and get it to swallow up vscode itself now for that matter as shown below) and working pretty much error-free 100% of the time for most of us.....then why is it again that vscode with the entire MS DEV at it's disposal can't get even close to the conemu equivalent terminal emulator for only the Posh/PoshCore hosting/emulation?

The issue is when everywhere I look vscode is being pushed as "the" IDE with "terminal" for Posh DEV right now, yet I cannot even so much as paste a simple multi-line splatted param or hashtable into the only viable Posh "terminal" in vscode without every line vomiting red because the interpreter has no concept of what a line continuation even is...or as Joel said total lack of basic navigation.....despite the fact that by now it really should be, it is unfortunately IMO still not ready for serious Posh development usage and there is no way I can come close to moving coding efforts into vscode....but after 30+ yrs of being a MS evangelist I guess a boy can still dream! 😉


If it helps, here is vscode being pulled into Conemu as a child docked terminal with full injection and ANSI support: (So why can't powershell.exe or pwsh.exe be integrated into vscode the exact same way proven to work for years in conemu? It's using WINAPI and injection all fully supported methods last I checked)

84a7f14e-16e5-11e6-933b-96f5f5f9ccc2

@SeeminglyScience
Copy link
Collaborator

@CollinChaffin The difficult part wasn't getting PSReadLine to work in VSCode.

The challenge was getting PSReadLine to work in the same PowerShell runspace as editor features like intellisense and debugging. Both need to be in the main pipeline thread, and finding a way to get them both to coexist in the same thread without completely rewriting them wasn't easy. As far as I'm aware there hasn't been any other editors that have implemented support for PSReadLine in a way that was integrated with editor features. The ISE is the closest I know of, but instead of supporting PSReadLine they wrote their own ReadLine implementation. Granted, that's still better than what is currently released for VSCode, but full PSReadLine support is ideal.

All that said, full support for PSReadLine is implemented. The latest preview build is available in this comment if you'd like to help test.

@sdsalyer
Copy link

sdsalyer commented Feb 8, 2019

Just popping in to cast my vote for multi-line support in the extension's "PowerShell Integrated Console". It works fine in the standard console opend via `ctrl+``, so it's frustrating when you open a ps1 file and suddenly it "stops working".

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Feb 8, 2019

@sdsalyer the "PowerShell Preview" extension in the marketplace has PSReadLine support and multi-line support.

Please check out our blog post here:
https://blogs.msdn.microsoft.com/powershell/2019/01/23/announcing-the-powershell-preview-extension-in-vscode/

@SydneyhSmith
Copy link
Collaborator

Closing as PSReadLine is now available in the PowerShell Preview extension, tracking that PSReadLine is not available in the main PowerShell Extension here #1793

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Extension Terminal Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests