2

How do we deal with a problem in Visual Studio Code in its integrated terminal?

Warning: PowerShell detected that you might be using a screen reader and has disabled PSReadLine for compatibility purposes. If you want to re-enable it, run 'Import-Module PSReadLine'.

mklement0
  • 382,024
  • 64
  • 607
  • 775
wolf Ghost
  • 21
  • 2

1 Answers1

1

According to @mklement, you should not actually see this issue in the PowerShell Integrated Console, but the workaround is the same regardless of which console host you are using; if you get the warning just import PSReadLine to restore the functionality of PSReadLine, and the easiest way to make this happen is to add the Import-Module PSReadLine to your PowerShell profile.


In the PowerShell Integrated Console, run:

code $profile

to open your VS Code PowerShell Profile (it is different by default than your standard $profile location in other terminals). Then put:

Import-Module PSReadLine

at the top, and Save. Now you can close and reopen your PowerShell Integrated Console, or type:

. $profile

to get the latest $profile code updated in your current session.


Note that the PowerShell Integrated Console is different from a regular PowerShell terminal. This session controls the PowerShell session used internally by the VSCode PowerShell extension. If you get this in one of the integrated terminals using an external PowerShell session (not the PowerShell Integrated Console), just add the module import to one of the standard $profile locations.

codewario
  • 19,553
  • 20
  • 90
  • 159
  • 1
    OP said integrated terminal so I assumed they saw this with the PowerShell Integrated Terminal. Easy workaround in the case of a regular terminal session is to just add the same `Import-Module` line to one of the standard `$profile` scripts but I believe the warning still shows since the warning comes before your profile import. Although your answer you linked to does shed light on what's happening and other ways to mitigate the issue. – codewario Aug 09 '21 at 19:39
  • To summarize: I believe no workaround is necessary for the _PowerShell Integrated Console_, but it is necessary for running PowerShell as a _regular shell_ in the integrated terminal - and your workaround steps can be used as-is there. The limitation of the workaround is that the warning is still shown on startup. To fix the underlying problem, refer to the [linked duplicate](https://stackoverflow.com/questions/66748513/re-enable-import-module-psreadline-warning). – mklement0 Aug 09 '21 at 20:06