Add PowerShell language model tools and redesign the Command Explorer#5508
Draft
andyleejordan wants to merge 5 commits into
Draft
Add PowerShell language model tools and redesign the Command Explorer#5508andyleejordan wants to merge 5 commits into
andyleejordan wants to merge 5 commits into
Conversation
Show Help previously printed `Get-Help` output into the integrated console and, when nothing was selected, sent the entire document as the help target. The latter was a `getWordRangeAtPosition` bug: off a word it returns `undefined`, and `doc.getText(undefined)` returns the whole document. Resolve the word at the cursor explicitly (falling back to the selection), send it to the new `powerShell/showHelp` request, and render the returned text in a read-only virtual document so help opens in a proper editor pane instead of an editable untitled buffer. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Command Explorer fetched the full command table up front (names, modules, and parameter metadata for everything), which took minutes to populate and showed a flat, hard-to-scan list. Rework it into a lazy, module-grouped tree: - Top-level nodes are modules (with version), expanded on demand; their commands are fetched per module with `excludeParameters` so only names and modules cross the wire. - Module-less commands are collected under a neutral "Functions & Scripts" node with a folder icon, and the request sets `excludeDefaultFunctions` so PowerShell's default-session plumbing doesn't clutter it. - Hovering a module shows its metadata via the new `powerShell/getModule` request, cached so repeated hovers don't re-fetch. - The inline Show Help / Insert command actions are gated to `viewItem == command` so they no longer appear on module nodes. Default the Command Explorer to visible. Because its default now equals the value the ISE profile sets, the ISE compatibility tests could no longer observe a revert by inequality; guard those assertions with `revertIsObservable`, which skips settings whose default already matches the ISE value. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Register four read-only language model tools that Copilot can call when working with PowerShell, each backed by an existing PSES request so they report exactly what the user's session would: - `powershell_get_command` lists commands, optionally scoped by name and/or module, using the now-parameterized `powerShell/getCommand` request with `excludeParameters` so large listings stay cheap. - `powershell_get_help` returns `Get-Help` output via `powerShell/showHelp`. - `powershell_get_environment` reports the PowerShell version table. - `powershell_expand_alias` resolves aliases to their underlying commands. All four are read-only and declare no confirmation requirement. Contribute them in `package.json` and wire up `LanguageModelToolsFeature` in `extension.ts`. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Record that `modules/` is a symlink to the sibling PowerShellEditorServices `module` directory, so building PSES deploys its DLLs straight into the path the extension and its tests load from — meaning C# changes require rebuilding PSES by hand, and `npm test` exercises the real Extension Host against the locally built server. This trips up anyone (including Copilot) who edits PSES and wonders why the extension didn't pick it up. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Point the `PowerShellEditorServices` checkout at the coupled PR branch `andyleejordan/lm-tools-command-explorer` so #5508's new language model tool tests run against the server contract they depend on (name/module filtering on `getCommand`, `showHelp` returning `helpText`). Must be reverted before merge — once PSES #2298 lands on `main`, the default checkout passes. Drafted by Copilot (Claude Opus 4.8). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds PowerShell language model tools, redesigns the Command Explorer, and renders Show Help in a read-only editor pane. Backed by new LSP requests in PowerShell/PowerShellEditorServices#2298 — that PR must land with this one.
powerShell/showHelpand show it in a virtual document; fix the off-wordgetWordRangeAtPositionbug where an empty selection sent the whole document.getModulehover tooltips (cached), a neutral "Functions & Scripts" bucket with a folder icon,excludeParameters/excludeDefaultFunctionsrequest flags, inline-action gating toviewItem == command, and defaulting the view to visible (with arevertIsObservableguard so the ISE compatibility tests still pass).powershell_get_command,powershell_get_help,powershell_get_environment,powershell_expand_alias), each backed by an existing PSES request, contributed inpackage.jsonand wired up inextension.ts.Drafted by Copilot (Claude Opus 4.8)