Autocomplete that knows what you imported

DetentShell · August 2026 · 1 min read

There are two ways to build PowerShell completion. Ship a static catalog of known cmdlets and hope it covers what the user types, or ask the engine that’s running.

DetentShell asks the engine. Completion calls PowerShell’s own CommandCompletion API against your tab’s runspace. The difference shows up the first time you import something. Load dbatools, or your own module, and every one of its commands and parameters completes immediately, because the completer and your session are the same process asking itself. Define a function at the console and the editor completes it. Assign $inventory and $inv finishes. A static catalog can’t do any of that; it’s a snapshot of someone else’s PowerShell.

The mechanics stay quiet. Ctrl+Space asks explicitly. Typing . or - asks automatically, since members and parameters are where completion earns its keep. Requests are debounced and run off the UI thread when the runspace is idle, so typing never stutters and a completion query never collides with a running pipeline. There’s a configurable timeout, and when a query exceeds it the popup simply doesn’t appear. Completion is a convenience; a convenience you wait on has failed.

Two checkboxes in Settings exist because muscle memory splits the population: whether Enter accepts the highlighted completion, set separately for the script pane and the console. If Enter at the console means “run my line, not insert Get-ChildItemProperty first,” uncheck the console one and only Tab commits. People hold strong opinions on this. Both opinions are supported.

The same live-session principle runs through the neighboring features. The Functions dropdown is parsed from your buffer’s actual syntax tree. F1 renders help from your session’s help system. One engine, and every assist wired to it rather than to an approximation of it.

← All posts