PowerShell/vscode-powershell

IntelliSense is not triggered by trigger characters

MartinGC94 opened this issue · 2 comments

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

VS code will by default trigger IntelliSense when you start typing, however you can turn this off and only have it get triggered when certain characters are typed. This is controlled by the following settings:

"editor.suggestOnTriggerCharacters": true,
    "editor.quickSuggestions": {
        "other": "off",
        "comments": "off",
        "strings": "off"
    }

If you set these settings and try to edit the VS code settings.json file you will see that IntelliSense is automatically triggered when you type in " but not when you type normal words, so it works exactly as you'd expect. In PowerShell the only trigger characters that work are . and \ but there are more triggers defined in editor services: https://github.com/PowerShell/PowerShellEditorServices/blob/main/src/PowerShellEditorServices/Services/TextDocument/Handlers/CompletionHandler.cs#L56

This setting used to work just fine back in 2021 when I added $ as a trigger character: PowerShell/PowerShellEditorServices#1427 but I have no idea when it stopped working.

PowerShell Version

Name                           Value
----                           -----
PSVersion                      7.5.0-preview.3
PSEdition                      Core
GitCommitId                    7.5.0-preview.3
OS                             Microsoft Windows 10.0.19045
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name             : Visual Studio Code Host
Version          : 2024.3.2
InstanceId       : 7aca87d3-2cd2-4ec6-984c-9d163813f6d5
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : da-DK
CurrentUICulture : da-DK
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

1.92.0-insider
b1c0a14de1414fcdaa400695b4db1c0799bc3124
x64

Extension Version

ms-vscode.powershell@2024.3.2

Steps to Reproduce

Configure the following VS code settings:

"editor.suggestOnTriggerCharacters": true,
    "editor.quickSuggestions": {
        "other": "off",
        "comments": "off",
        "strings": "off"
    }

Type in $ or Get- or $global: and notice how none of them trigger IntelliSense.
Type in "". or C:\ and notice that IntelliSense is triggered as expected.

Visuals

No response

Logs

No response

Thanks! @MartinGC94 are you saying that . and \ work but the other characters aren't working anymore?

Yes exactly.