Earlier today when opening a PowerShell script in Visual Studio Code I got the following error message:
The language service could not be started:
Source: PowerShell (Extension)
After some investigation that included changing the Editor Services log level to Diagnostic, and decoding the base64 encoded command being passed to pwsh, it was pointed out to me on GitHub that PowerShell versions prior to 7 contain a bug that, when they’re installed as a .NET Core global tool, prevents them from processing parameters passed to the pwsh command.
So just to confirm the version I had installed, I ran…
dotnet tool list -gPackage Id Version Commands powershell 6.2.3 pwsh
… and then after closing opened instances of Visual Studio Code, I updated PowerShell using .NET Core’s CLI:
$ dotnet tool update powershell -g Tool 'powershell' was successfully updated from version '6.2.3' to version '7.0.0'.
In case you didn’t install PowerShell through .NET Core’s CLI, you may want to take a look at “Installing various versions of PowerShell” over on Microsoft Docs where you’ll find instructions for installing PowerShell on all the supported target platforms.
One thought on “The language service could not be started: Source: PowerShell (Extension)”