Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Add support for renaming PowerShell class references

Aberta
#2,293 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
devtools, tooling

Direção de pesquisa

Comece reproduzindo os dois exemplos de classes e pressionando F2 nas referências aos nomes das classes. Acompanhe o tratamento existente de renomeação no PowerShell Editor Services, incluindo referências a classes no mesmo arquivo e o comportamento do sufixo opcional Attribute. Considera-se concluído quando a renomeação atualiza de forma consistente a declaração, o construtor, as referências de tipo e o uso do atributo.

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

Descrição

Issue-Bug Needs: Triage
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 PowerShell Editor Services itself and does not reproduce in a standalone PowerShell instance, and is not an issue with my editor.
  • I have verified that I am using the latest version of PowerShell Editor Services.
  • If this is a security issue, I have read the security issue reporting guidance.
Summary

This is not a bug, but the README says that rename scenarios should be filed as bug reports, so that's what I'm doing.
I think it should be fairly trivial to add renaming support for PowerShell classes defined in the same script file.
Expected:

class DemoClass
{
    [string] $SomeProperty

    DemoClass ([string] $SomeArg)
    {
        $this.SomeProperty = $SomeArg
    }
}

[DemoClass]

Actual:

class NewName
{
    [string] $SomeProperty

    NewName ([string] $SomeArg)
    {
        $this.SomeProperty = $SomeArg
    }
}

[NewName]

One thing to keep in mind during implementation is that a PowerShell class can also be used to define an attribute, and an attribute type can drop the optional Attribute suffix in an attribute context as seen here:

class ValidateSomethingAttribute : System.Management.Automation.ValidateArgumentsAttribute
{
    [void]Validate([System.Object]$arguments, [System.Management.Automation.EngineIntrinsics]$engineIntrinsics)
    {
    }
}
[ValidateSomething()][string]$Path = "c:\windows"
PowerShell Version
Name                           Value
----                           -----
PSVersion                      7.6.1
PSEdition                      Core
GitCommitId                    7.6.1
OS                             Microsoft Windows 10.0.26200
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.4
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Editor Version
VS code:

Version: 1.117.0 (system setup)
Commit: 10c8e557c8b9f9ed0a87f61f1c9a44bde731c409
Date: 2026-04-21T16:12:14-07:00
Electron: 39.8.7
ElectronBuildId: 13841579
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
OS: Windows_NT x64 10.0.26200
PowerShell Editor Services Version
Major  Minor  Build  Revision
-----  -----  -----  --------
4      6      0      0
Steps to Reproduce

Use the code blocks from before and press F2 on the class name references.

Visuals

No response

Logs

No response

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.