PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code

Home Page:https://marketplace.visualstudio.com/items/ms-vscode.PowerShell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function Parameters in a Class Module Do Not Show in Intellisense/Autocompletion

eneerge opened this issue · comments

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

I have written a simple class that I am trying to use within another script. After I have created an object of the class, the functions that belong to that class show up in intellisense, but the parameters for the function do not appear. I can't tell what parameters need to be passed to the function.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.22631
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.2.2
InstanceId       : b43e0373-a30a-41ba-8453-b3b9b029611b
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : en-US
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

Version: 1.89.1
Commit: dc96b837cf6bb4af9cd736aa3af08cf8279f7685
Date: 2024-05-07T05:13:33.891Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22631

Extension Version

Name: PowerShell
Id: ms-vscode.powershell
Description: Develop PowerShell modules, commands and scripts in Visual Studio Code!
Version: 2024.2.2
Publisher: Microsoft
VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-vscode.PowerShell

Steps to Reproduce

Below code is being used in the attached gif to show the issue.

Test.psm1

class Test {
  Test() {}

  doSomething([string]$NotShowingInIntellisense) {
    write-host "But I still run properly."
  }
}

main.ps1

using module ".\Test.psm1"

$obj = [Test]::new()

# doSomething shows up in intellisense, but none of the parameters do
$obj.doSomething("test")

Visuals

Code_xhMhnyynOA

Logs

No response

Thanks for the submission! Note that autocomplete comes mostly from the core PowerShell engine, and if you can't intellisense it there, it's not going to work here. If you put the same in a normal powershell terminal and hit tab or ctrl-space, you'll notice no intellisense exists here either.

For example, hit ctrl-space with doSomething and you will see where the intellisense info for vscode comes from
image

Do the same for the parameter and nothing appears.

So this needs to be resubmitted to the PowerShell repo and implemented in the PowerShell completion, and it will automatically flow to vscode.

This issue has been labeled as resolved, please verify the provided fix (or other reason).

This issue has been labeled as resolved, please verify the provided fix (or other reason).

@JustinGrote so it's a very funnily setup bot but it uses "Needs: Fix Verification" as the "stale" label. I'm going to rename it because that's obviously confusing...but it's been adding that so that it can back along and go "oh this was marked as stale, but it's been a week, closing."

This issue has been labeled as resolved, please verify the provided fix (or other reason).

This issue has been labeled as needing fix verification and has not had any activity a week. It has been closed for housekeeping purposes.