[PSS 2016][Misdemeanor] Autocomplete and statements

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Posts: 282
Meble kuchenne na zamówienie - na wymiar - Wrocław
Joined: Sun Mar 03, 2013 12:45 pm

[PSS 2016][Misdemeanor] Autocomplete and statements

Post by Bosparan »

PSS Version: 2016 5.2.117
OS Version: Windows 10 x64
WMF Version: 5.0

Impact: Serious Annoyance

Autocomplete and Primal Sense will mark and auto-insert a function as soon as you finish a recognized verb. This is in general benign, as I can keep typing to refine the proposed insert or select it in the primal sense window.
However, this does not work well when certain powershell statements have the same name as some verbs, or when an type accelerator has the same name as a legit verb.
Typically affected are:
- Begin-Statement
- Process-Statement (Process is not an officially sanctioned verb, but still finds frequent enough usage)
- End-Statement
- Switch-Statement
- Switch-Accelerator (System.Management.Automation.SwitchParameter)

1) Install any of the following modules:
- Azure
- HPOACmdlets (HP PowerShell Management Kit)
These include cmdlets using the verb "Switch"

2) Recreate PSS Cache
3) Type this in the console ("|" is the current cursor position)
  1. $foo = "bar"
  3. switc|
4) Type another "h". Primal Sense should now propose a cmdlet with the Verb Switch, autocomplete will select it
5) Type space to continue a typical switch statement. Autocomplete will now insert the selected cmdlet

Notes on Solution:
An idea I had was to mark for autocomplete only once one adds [Verb] + [-]. In the example above, that would mean only provide autocomplete once the user types "Switch-", rather than how it is now already after "Switch". This would remove all collisions with statements and accelerators.

Site Admin
Posts: 1098
Joined: Mon Aug 17, 2015 2:25 pm

Re: [PSS 2016][Misdemeanor] Autocomplete and statements

Post by DevinL »

I've passed this on to the team and will let you know when I have some more information.

In the meantime, you can check the Autocomplete on exact match only option and it should stop this from happening.
Auto_Complete.png (20.36 KiB) Viewed 1518 times
SAPIEN Technologies, Inc.

Posts: 282
Joined: Sun Mar 03, 2013 12:45 pm

Re: [PSS 2016][Misdemeanor] Autocomplete and statements

Post by Bosparan »

Hi Devin,

thanks, and I hope something will come along, as it's rather troublesome. I'm aware of the workaround, but it's the greater evil, considering how autocomplete is a productivity increase most of the times (with above mentioned exception). If we disable it, we'll simply be irked when we don't get it but would like to. We're so used to autocomplete by now, that disabling it would just create a low of input errors where force of habit causes errors.

Btw, another very notable (and omnipresent) case of this issue is foreach vs. ForEach-Object.


User avatar
Posts: 5913
Joined: Thu Aug 18, 2011 4:56 am

Re: [PSS 2016][Misdemeanor] Autocomplete and statements

Post by davidc »

You could try unchecking the "Enable word completion while typing" feature in Options->PrimalSense.

This will prevent the PrimalSense list from popping up after typing text that is longer than 3 characters.

Note: Pressing TAB will always auto-complete the current selection even when the "Autocomplete on exact match only" is checked.

SAPIEN Technologies, Inc.

Posts: 282
Joined: Sun Mar 03, 2013 12:45 pm

Re: [PSS 2016][Misdemeanor] Autocomplete and statements

Post by Bosparan »

Hi David,

yes, disabling "Enable word completion while typing" would be a workaround around this. But - same as "Autocomplete on exact match only" the productivity loss would be worse.
Good to know I can force completion with tab, though that's not how our usage generally works (Which means, that while the latter option and "Tab" would be a fairly functional workaround, it would require more changes in habit than cancelling the primal sense with "ESC").

In the end we will go on with ESCaping Primal Sense (and cursing whenever we forget), but a fundamental fix will be appreciated :)

Thank you for the suggested workarounds,