question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Completions while remoting are from local context

See original GitHub issue

System Details

System Details Output

### VSCode version: 1.44.2 ff915844119ce9485abfe8aa9076ec76b5300ddd x64

### VSCode extensions:
ms-vscode-remote.remote-ssh@0.51.0
ms-vscode-remote.remote-ssh-edit@0.51.0
ms-vscode.notepadplusplus-keybindings@1.0.5
ms-vscode.powershell-preview@2020.3.0


### PSES version: 2.1.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.18362.752
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.752
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

When I use the integrated console with version 2020.4.0 of the extension, and I am connected to a remote server using PowerShell remoting, file path autocompletion does not run in the remote session.

I type "cd ", then the first few letters of the file path, then hit Tab, and nothing happens. I expect it to start autocompleting the file path when I hit Tab.

  • File path autocompletion works when accessing the local file system (i.e. when not using remoting).
  • It works when using remoting if I set “powershell.integratedConsole.useLegacyReadLine” to true.
  • It also works when using remoting in the initial console that VS Code loads (as opposed to the “PowerShell Integrated Console”).

This problem does not happen when using version 2020.3.0 of the extension.

I believe that this issue was introduced in the 2020.3.1-preview release, because it works for me in 2020.3.0-preview but not in 2020.3.1-preview.

The log entries for a successful use of autocompletion with 2020.3.0-preview look like this:

2020-04-24 08:59:57.925 -05:00 [VRB] StartReadLoop called while read loop is already running
2020-04-24 08:59:57.925 -05:00 [VRB] Attempting to execute command(s):

    prompt

2020-04-24 08:59:57.925 -05:00 [VRB] Session state changed --

    Old state: Ready
    New state: Running
    Result: NotFinished
2020-04-24 08:59:58.002 -05:00 [VRB] Session state changed --

    Old state: Running
    New state: Ready
    Result: Completed
2020-04-24 08:59:58.002 -05:00 [VRB] Execution completed successfully.
2020-04-24 08:59:58.003 -05:00 [VRB] Attempting to execute command(s):

    
            [System.Diagnostics.DebuggerHidden()]
            [System.Diagnostics.DebuggerStepThrough()]
            param()
            return [Microsoft.PowerShell.PSConsoleReadLine, Microsoft.PowerShell.PSReadLine2, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null]::ReadLine(
                $Host.Runspace,
                $ExecutionContext,
                $args[0]) System.Threading.CancellationToken

Meanwhile, they look like this for 2020.3.1-preview:

2020-04-24 08:53:32.884 -05:00 [VRB] StartReadLoop called while read loop is already running
2020-04-24 08:53:32.884 -05:00 [VRB] Attempting to execute command(s):

    prompt

2020-04-24 08:53:32.888 -05:00 [VRB] Session state changed --

    Old state: Ready
    New state: Running
    Result: NotFinished
2020-04-24 08:53:32.971 -05:00 [VRB] Session state changed --

    Old state: Running
    New state: Ready
    Result: Completed
2020-04-24 08:53:32.971 -05:00 [VRB] Execution completed successfully.
2020-04-24 08:53:32.977 -05:00 [VRB] Attempting to execute command(s):

    __Invoke-ReadLineForEditorServices -CancellationToken System.Threading.CancellationToken

2020-04-24 08:53:47.898 -05:00 [VRB] Execution completed successfully.

Attached Logs

logs.zip

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
lookclosercommented, May 5, 2022

It looks like the 2022.5.0 release has fixed this problem: the integrated console is once again suggesting file paths on the remote computer when using remoting.

I believe that this issue can be closed, but leaving it open in case anything else needs to be done here.

1reaction
lookclosercommented, Apr 24, 2020

If I remove the PSReadLine directory and restart VS Code, then the integrated console reverts to using the default PSReadLine 2.0.0, and autocomplete starts working again.

However, if I put the PSReadLine directory in my ~\Documents\WindowsPowerShell\Modules directory and then launch Windows Terminal or the legacy PowerShell command line app, they load version 2.1.0 of PSReadLine and are still able to perform file path autocompletion when using remoting.

This makes me think that it may be an interaction between the newer PSReadLine and this extension, rather than a bug in the newer PSReadLine per se.

Read more comments on GitHub >

github_iconTop Results From Across the Web

zsh completion for scp completes local users when connecting ...
Lets say, I have one file in current directory, test.txt and I want to transfer it using scp to remote server. When I...
Read more >
Remote Development FAQ - Visual Studio Code
Visual Studio Code Remote Development allows your local VS Code installation to transparently interact with source code and runtime environments on other ...
Read more >
Scheduling and Handling Local Notifications - Apple Developer
You schedule local notifications at a time when your app is running either in the foreground or background. After scheduling a notification, ...
Read more >
PowerShell Remoting FAQ - Microsoft Learn
Yes. PowerShell remoting is available even when the local computer is not in a domain. You can use the remoting features to connect...
Read more >
20 Completion System - zsh
The context that decides what completion is to be performed may be ... used to look up the urls and local styles when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found