PowerShell / PowerShell/vscode-powershell

IntelliSense is not triggered by trigger characters

Open
#5,022 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-IntelliSense Issue-Bug
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

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: https://github.com/PowerShell/PowerShellEditorServices/pull/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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the extension's completion handling with the linked PowerShellEditorServices CompletionHandler.cs entry point and reproduce the behavior using the listed VS Code settings. Check trigger behavior for $, Get-, and $global: against the working . and \ cases. Done means the configured trigger characters invoke IntelliSense as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.