You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
type completion overwrites type name with member if accessor appears after cursor #10529
[convert]:: #locate cursor over `]` and press <CTRL-SPACE>
Expected behavior
Show completions for the type(s) beginning with convert
Actual behavior
Instead of offering completions for convert (to which there might not be any), it instead replaces convert with the first member of [convert], DBNull.
[DBNull]::
Environment data
Name Value
---- -----
PSVersion 7.0.0-preview.3
PSEdition Core
GitCommitId 7.0.0-preview.3
OS Microsoft Windows 10.0.18362
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
This does appear to happen all the way back to Windows PowerShell 5.1 (on the above listed Windows 10 system).
I might try to debug in to this later. It would seem to me that the completion logic is missing the fact that the cursor position is still inside the 'type' reference and so it should be completing the type reference, not the member accessor that follows it.
Interestingly enough, VS Code (the PowerShell extension uses the completions from a PowerShell session) doesn't seem to have this issue, probably because the extension uses its own logic to determine what its actually completing. (incomplete comparison, when put in the same situation, VS Code offers no completions at all)
So far, I have determined that this only happens when the expression near the cursor results in a 'MemberExpressionAst', and the expression results in an error ('ErrorExpressionAst') due to the member expression not being complete, and the token at the cursor is a TokenKindIdentifier.
I have found other scenarios where this occurs, such as:
$psversiontable.pscompatibleversions. # put cursor before last . and press <CTRL-SPACE>
Activity
iSazonov commentedon Sep 13, 2019
I can confirm.
msftrncs commentedon Sep 13, 2019
So far, I have determined that this only happens when the expression near the cursor results in a 'MemberExpressionAst', and the expression results in an error ('ErrorExpressionAst') due to the member expression not being complete, and the token at the cursor is a
TokenKindIdentifier.I have found other scenarios where this occurs, such as:
Result is (with a menu of
arraymembers)$psversiontable.Count.