Have `expandAlias` emit `TextEdit`s like the rename handler instead of a custom request

Aberta
#2,315 1 comentário 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Pouca atividade
Stack de tecnologia
csharp, powershell
Domínio
api, tooling

Direção de pesquisa

Comece por ExpandAliasHandler, RenameService e ScriptExtentAdapter, usando #2312 e #2108 como contexto. Rastreie o plumbing existente da solicitação powerShell/expandAlias e do cliente vscode-powershell; depois compare a saída TextEdit do rename handler. O trabalho estará concluído quando a expansão de alias emitir edits para command-name extents e o contrato do cliente for atualizado ou a solicitação personalizada for deprecated.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Area-Language Server Issue-Enhancement

Follow-on from @JustinGrote's review on #2312: https://github.com/PowerShell/PowerShellEditorServices/pull/2312#pullrequestreview-4521187389

Yeah looks fine to me. As a follow-on issue we should probably update the rename handler to use this same code path if it isn't already.

The rename handler (RenameService) is already on the modern path — it uses System.Management.Automation.Language.Parser.ParseInput plus AST visitors and never used the legacy PsParser, so there's nothing to migrate there. #2312 brought ExpandAliasHandler onto the same modern parser.

The remaining divergence is in output shape, and the reusable direction is the reverse of "rename adopts expand-alias": expand-alias should adopt rename's edit model.

  • ExpandAliasHandler resolves aliases, then returns a single wholesale-rewritten string over the custom powerShell/expandAlias JSON-RPC request.
  • RenameService walks AST extents and returns TextEdit[] over standard textDocument/rename, using ScriptExtentAdapter to map PowerShell 1-based extents to LSP 0-based ranges.

This is also what #2108 itself anticipated: "return a proper edit (potentially deprecating the need for an entirely separate custom request)."

Proposed work:

  • Rework alias expansion to emit TextEdits (reusing ScriptExtentAdapter) covering each command-name token's extent, instead of returning a rewritten document.
  • Investigate folding it into a standard LSP surface (e.g. a code action) and deprecating the custom powerShell/expandAlias request + its client plumbing in vscode-powershell.

Note this changes the client contract, so it needs coordination with the extension — which is why #2312 was scoped to just the parser swap.

Drafted by Copilot (Claude Opus 4.8).

Linguagem predominante
C#
Estrelas
767
Forks
266
Merge médio
3d 16h
PRs com merge (30d)
1

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de PowerShell/PowerShellEditorServices

Todas as issues de PowerShell/PowerShellEditorServices

Issues semelhantes

Mais issues de C#

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.