Closed PrzemyslawKlys closed 4 years ago
Similar situation is here:
On production PowerShell:
This actually has a huge side effect.
Notice how this function uses scriptblock { }
as a parameter and and then when uusing F5 or CTRL+F5 it takes whatever is displayed in the Terminal into tha script block (which in this case is file name). Only if use F6 (which in my case is Run Current File) it behaves as expected.
This makes it quite hard to work with.
Sorry for a bit of a delayed response but I am having trouble fully understanding what is happening here. Would you mind re-phrasing what the expected behavior is and what the current behavior is. Thanks as always!
What you're seeing here is few things:
And it will stay like that.
Let me try to explain this more simply.
This happens when "powershell.developer.featureFlags": [ "PSReadLine" ]
is enabled.
If you run your saved script (with F5 for example), the script path will be written to the console (as before). the only difference is that it's not adding a "line break" after writing the path.
it's not cussing any "coding problem" but a "display" one. if your code don't have any output, after the code run you will be left with your text cursor on the start of the path line so if you write something you are writhing it on the path text overwriting it. or if your code have output it will do the same thing and write it's first output line on the path line so if the output is shorter then the path you will get a line with a mix of the two strings displayed.
So the solution is just to make it line break/move to the next line after writing the path. Exactly as on a regular Powershell windows you will writhe the file path and hit enter and as a result the text cursor moves down and only then the file output starts from there.
It looks like start without debugging needs to add a new line either after writing the file path or before output is written, thanks for reporting this!
Just FYI. It's still not working correctly in 2.0.1
Can also confirm that it is still a problem. What is the point of releasing preview 2 to us if the bugs we reported on preview 1 are not addressed?
@ili101 preview.2 mostly contained work on the debugger. Sadly we couldn't get to everything this time around.
See also #1850
Is there a way to disable PSReadLine? In earlier versions, it was not enabled by default. Now it is, yet this issue is not fixed so it makes it really hard for me to cope with the output it provides.
Yes, you can do this in your settings:
powershell.developer.featureFlags: []
Ok so circling back here. This issue and https://github.com/PowerShell/vscode-powershell/issues/1850 are very closely related. In fact, they may be the same bug.
The file path showing up makes sense as an indicator that you are, in fact, running the script.
What's not correct is that you should be seeing a prompt after that line, and you're not.
Making this a duplicate
This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.
System Details
System Details Output
Issue Description
I am experiencing a problem with... filename showing up in Console window on F5/CTRL+F5
While when there is some content output it will be removed when it's done, when there's no content (such as the .ps1 file has only function definition) it will look like on attached gif.