-
Notifications
You must be signed in to change notification settings - Fork 241
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Steps to reproduce
Note:
- I've observed the symptom in the context of tab-completion in Visual Studio Code, but I assume the underlying problem is relevant to this repo.
-
The editor's tab completion / IntelliSense always "knows" the following phantom variables due to a leaky implementation detail (they correspond to the parameter names of the
TabExpansion2function):$ast,$tokens,$positionOfCursor,$options
-
Tab-completion / IntelliSense results of these variables is based on the type these (parameter) variables have in
Tabexpansion2, even if you explicitly define them with a value of a different type.-
For instance, even if you define
[int] $positionOfCursor = 42in your script, tab-completion on a later line still shows the properties of the[IScriptPosition]type that the-positionOfCursorparameter is typed as. -
Even if you don't define your own versions of these variables, their mere (ostensible) presence during tab-completion is confusing.
-
In an empty .ps1 file open in Visual Studio Code, type the following
$tokens.Expected behavior
No IntelliSense results, given that $tokens isn't defined.
Actual behavior
IntelliSense results are the [array] type's instance property names, because the -token parameter of TabExpansion2 happens to be array-typed (Token[]])
Error details
No response
Environment data
Name Value
---- -----
PSVersion 7.3.0
PSEdition Core
GitCommitId 7.3.0
OS Darwin 22.1.0 Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Version
PowerShell Extension v2022.11.0
Visuals
No response