Intellisense not behaving properly before class object is instantiated
fflaten opened this issue · 2 comments
fflaten commented
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
class Person {
[string]$Name
[int]$Age = 999
Person([string]$name) {
$this.Name = $name
}
Person([string]$name, [int]$age) {
$this.Name = $name
$this.Age = $age
}
[string]GetIntroduction([string]$greeting) {
return "$greeting $($this.Name)"
}
[string]GetIntroduction([bool]$withAge) {
return "Hello $($this.Name) ($($this.Age))"
}
}
# 1. Run until this point. Don't execute the next lines
# ctrl+space at end $p. to open intellisense.
# Look at GetIntroduction (missing second overload) and Person (shouldn't be there)
$p = [Person]::new("Frode")
$p.
# 2. Execute next line
$p = [Person]::new("Frode")
# 3. ctrl+space at end of next line and check again. both method overloads visible + no constructor as expected
$p.
Expected behavior
Intellisense/completion shows the same step 3 at step 2
Actual behavior
Difference. Intellisense for members of `$p` include constructor and only first overload of methods. See images below
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.2.5
PSEdition Core
GitCommitId 7.2.5
OS Linux 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Version
2022.8.2 preview
Visuals
MartinGC94 commented
PowerShell provides the tooltips, not editor services. This issue was fixed in PS version 7.3 preview 5, specifically this PR: PowerShell/PowerShell#16963 so if you can run a preview version there's a fix available, otherwise you will need to wait for the final release.
fflaten commented
@MartinGC94 You Sir, are one step ahead of the rest.🥇 Thanks!