Namespace completion not triggered after new \ or \
Environment
- Intelephense version: 1.17.3
- VS Code version: 1.112.0
- OS: Ubuntu Linux (UK keyboard layout)
Description
Typing \ does not trigger namespace completion suggestions, despite \ being registered as a trigger character in Intelephense's capabilities. The completion request is sent correctly with triggerKind: 2 and triggerCharacter: "\\", but Intelephense returns an empty result set immediately (within ~4ms, suggesting it is rejecting the context rather than searching).
Steps to reproduce
- Open any PHP file with a namespace declared
- Inside a method body, type
$x = new \ or just \
- Observe that no completion suggestions appear
- Typing a class name however does work, and will also import in the fully qualified name in a
use statement at the top of the file.
Expected behaviour
A list of available namespaces and classes should appear, e.g. \App\, \Illuminate\, allowing the user to browse and select a fully qualified class name.
Actual behaviour
No suggestions are returned. The LSP trace shows:
{
"context": {
"triggerKind": 2,
"triggerCharacter": "\\"
}
}
{
"items": [],
"isIncomplete": false
}
Additional context
- Typing
use \ correctly triggers namespace suggestions — the bug is specific to the new \ context
- Typing a partial class name after
new (without \) works correctly and triggers class suggestions with auto-import
- The
\ trigger character is present in the server's initialize response:
"triggerCharacters": ["$", ">", ":", "\\", "/", "'", "\"", "*", ".", "<"]
- On a UK keyboard layout, VS Code identifies the
\ key as IntlBackslash rather than Backslash, meaning triggerKind: 2 was not firing at all without a custom keybinding workaround — however even after fixing the trigger kind, the completion result remains empty
Namespace completion not triggered after
new \or\Environment
Description
Typing
\does not trigger namespace completion suggestions, despite\being registered as a trigger character in Intelephense's capabilities. The completion request is sent correctly withtriggerKind: 2andtriggerCharacter: "\\", but Intelephense returns an empty result set immediately (within ~4ms, suggesting it is rejecting the context rather than searching).Steps to reproduce
$x = new \or just\usestatement at the top of the file.Expected behaviour
A list of available namespaces and classes should appear, e.g.
\App\,\Illuminate\, allowing the user to browse and select a fully qualified class name.Actual behaviour
No suggestions are returned. The LSP trace shows:
{ "context": { "triggerKind": 2, "triggerCharacter": "\\" } }{ "items": [], "isIncomplete": false }Additional context
use \correctly triggers namespace suggestions — the bug is specific to thenew \contextnew(without\) works correctly and triggers class suggestions with auto-import\trigger character is present in the server'sinitializeresponse:\key asIntlBackslashrather thanBackslash, meaningtriggerKind: 2was not firing at all without a custom keybinding workaround — however even after fixing the trigger kind, the completion result remains empty