Intellisense Does Not Expand Variable Name on Space in Regular Code or in Snippet Insertion

Issue #173 new
Nick De Lancie created an issue

For VS Community 2019 v. 16.2.3 (and prior versions) | PoshTools v. 4.9.0 (not Pro) (and prior versions) | $PSVersionTable at end

Baseline:

In VS for a VB.Net code project, when one starts to type a token (e.g., keyword, existing variable name, etc.), Intellisense presents a list of possible matches to the extent, so far, of the typing, and one can scroll down to, or single click on, the desired item. Once there, a space, a tab, an enter, a dot, an open parenthesis or square or curly brace (among other characters--I think all other characters than, in regex terms, \w, that is, [A-Za-z0-9_], will do this) will cause Intelllisense to put out the whole selected item plus whatever the instigating character was (and, if that was a ( [ { or “, also a closing ) ] } “), and further, if that character was a dot, present an Intellisense list of the properties, methods, events, etc., that are applicable to the just selected token.

Also, the Intellisense list box permits filtering the list by some or all of Keywords, Enums, Classes, Methods, Namespaces, Structures, Fields, Constants, Modules, Properties, Interfaces, and Locals and Parameters

And if one is inserting a code snippet with a substitution provision (e.g., the test condition in an if … then … end if block) , Intellisense will perform the same way for typing that is replacing the substitution placeholder, and will terminate the substitution operation and move to the next “field” in the snippet on typing an enter (the other instigating characters allow the substitution to be kept “alive”).

PS Variations:

In VS for a PS code project under Posh Tools, the behavior is different, as follows:

First, typing a space does not cause Intellisense to put out the whole selected item, it just enters a space after whatever characters had already been typed. All the other instigating characters appear to work as expected (I have not exhaustively tried them, but I have tried many of them).

Second, the Intellisense list box does not permit any filtering by item type. (This is likely related to what information VS collects--or does not collect--through the EnvDTE APIs about the active code, and since it doesn't natively support PS, it can’t collect the needed information to allow this parsing. That’s why, for example, CodeMaid’s Spade tool returns no information about PS code.)

Third, in code snippet insertion substitution, as above, typing a space does not cause completion, but also, typing enter does not always cause completion--it sometimes acts like a space with respect to the substitution, but also, as it does when it works properly, terminates the substitution and moves to the next “field” in the snippet. This behavior with enter mostly occurs if the Intellisense list has been displayed but no movement in it has yet occurred, but not always even then.

That’s it for now on this issue.

Thanks again for your work. Nick

\$PSVersionTable:

Name                                      Value
----                                          -----
PSVersion                                5.1.15063.1805
PSEdition                                 Desktop
PSCompatibleVersions            {1.0, 2.0, 3.0, 4.0...}
BuildVersion                            10.0.15063.1805
CLRVersion                              4.0.30319.42000
WSManStackVersion               3.0
PSRemotingProtocolVersion   2.3
SerializationVersion                 1.1.0.1

Comments (0)

  1. Log in to comment