PowerShell / PowerShell/vscode-powershell

Completions don't work in a completely empty script file

Open
#4,909 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-IntelliSense Issue-Bug
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

Prerequisites
  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

In this PR: https://github.com/PowerShell/PowerShell/pull/21171 I've added the ability to complete keywords without having to write a partial name, this works great except when the file is completely empty in VS code. The console host and even ISE handles completely empty input without any problems.

PowerShell Version
Name                           Value
----                           -----
PSVersion                      7.5.0-preview.1
PSEdition                      Core
GitCommitId                    7.5.0-preview.1-9-g0ecf5c46ddc68356ae8ef8be2bb0655b8a43023c
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name             : Visual Studio Code Host
Version          : 2024.0.0
InstanceId       : 17ccb628-ca60-4f48-8f98-1d70a9d57022
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : da-DK
CurrentUICulture : da-DK
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
Visual Studio Code Version
1.86.0-insider
5d344004f839677def958534b58e854a9ae26fd0
x64
Extension Version
ms-vscode.powershell@2024.0.0
Steps to Reproduce
  1. Download a build from the branch
  2. Launch the pwsh executable and check the PID $pid
  3. From VS code, type in Enter-PSHostProcess <PID from before>
  4. Press Ctrl+Space in an empty file
Visuals

No response

Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Ctrl+Space completion failure in a completely empty file using the listed PowerShell, VS Code, and extension versions, then trace the completion entry point used by the extension. Done means keyword completions appear in an empty script, matching behavior in the console host and ISE.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.